Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

ImageX HTA with Win PE 3.0/4.0 x64/x86

- - - - -

  • Please log in to reply
66 replies to this topic

#51
dcistech

dcistech
  • Member
  • 8 posts
  • Joined 10-May 12
  • OS:none specified
  • Country: Country Flag
Tripredacus, thank you for taking the time to reply. I know this all non-standard, and not your script originally, so thanks for taking the time to comment.

A quick clarification: when you say it's working in 3.1 x64, do you mean the progress bar as well?

As for the cmdcount (cmdpc) business, I've gone ahead and removed it as part of my modifications--I see no point to keeping it in a Win7PE_SE version wherein the circumstances its checking for don't really exist. I'm building a WIN7PE_SE with it removed, and I'll check on functionality to report back to everyone. If I manage to get it all working, I plan to post if for everyone who cares to add it to WIN7PE_SE.

I'm guessing my issue was not being able to see the progress bar, as the HTA does appear to have renamed the primary partition of my test machine "system" which it was not named before. The only question then, if the progress bar is working in 3.1 x64, is what I need to do to get it to work in 3.1 x86, or if it's an issue of video drivers/cards. In that case, I may try a few drivers.

Depending on what happens with the build of WIN7PE_SE I'm making right now, I'll double check with a normal PE 3.1 and see what happens. It'd still be better than nothing (and far more capable than the old version of this HTA that's currently in use in my organization). I'll edit this post to provide updates hopefully later this afternoon.

Thanks again for your help.

EDIT: So, good news. The only major issue is the progress display. It applies the images just fine. I'm currently experimenting with using the 6.0 wimgapi.dll (the same .dll called for by the normal GImageX WIN7PE_SE script), the updated GImageX_COM from autoit, and the newest SetRes to see if that somehow changes anything (at the very least, they're more recent versions, meant to play nice with windows 7). I'm also having trouble with the network drive mapping window, in that it displays mostly off screen. I've messed with how it determines "center" to no discernible effect, and I'm turning off a few options in WIN7PE_SE. If that doesn't resolve it, I will try with a standard PE 3.1. Also, the cmdpc/cmdcount stuff was worthless. Nothing that I've seen indicates it's needed--at least in WIN7PE_SE. So, I've removed it.

Edited by dcistech, 11 May 2012 - 03:15 PM.



How to remove advertisement from MSFN

#52
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

No, the progress code is totally broken and won't work as designed. You could replace that code with an animation to show that it is actually doing something I suppose.

As it stands, my use of the HTA has diminished greatly in the past year. I do not know our actual usage of the public functionality but I would guess less than 30%. I likely won't make any code changes for the forseeable future. I typically use it to launch custom deployment apps.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#53
dcistech

dcistech
  • Member
  • 8 posts
  • Joined 10-May 12
  • OS:none specified
  • Country: Country Flag
Alrighty,

So I've been tidying up some things in the HTA, and I'm now working on getting a basic animation to display while it's working on whatever its doing. The problem I'm running into is that I can get the super-simple animation HTA window to open, but I'm struggling to get it to close properly. I've tried having it objShell.run(processing.hta) before the main capture/apply/etc operation, and that works great, but objShell.terminate doesn't want to work when the main operation is over (something about HTA limitations maybe?). I've also attempted window.open and window.close, but then I have to direct it to a plain .gif with the stupid IE frame around it. Which is annoying, because eventually I want the text of the processing window to be customized based on the action being performed.

Long story short: does anyone know how to get the main .hta to close the other animation .hta? I looked to the other HTAs run by the main one, and they all terminate themselves(window.close). I could even do that if I knew how to check whether the the main .hta was done, but I don't. All these strange limitations to vbscript in an HTA are frustrating.

Edited by dcistech, 18 May 2012 - 09:46 AM.


#54
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

My implementation of using an HTA for a progress animation is easy to close because it isn't being launched from an HTA. So I can just kill the mshta.exe process. However that won't go over too well with this setup, since it would kill your host HTA too!

So this is kind unimaginative but... clone mshta.exe to mshtatemp.exe. Then launch your progress HTA using mshtatemp.exe. Then when you are satisfied with your progress and you are done with the animation, then kill the mshtatemp.exe process. :D

However, I just realised I did do this when I had built a custom recovery partition for an old client... It appears I used window.close() to kill the child HTA when it was finished. So here is that code:

window.close()
   Exit Function
   End Function

Now the difference with my example is that I have that child HTA actually doing a task, so it stays open until that task is complete. In your use, you could do a similar thing except you'd need to check for a running diskpart.exe or imagex.exe task, and stay open as long as those processes are running.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#55
dcistech

dcistech
  • Member
  • 8 posts
  • Joined 10-May 12
  • OS:none specified
  • Country: Country Flag
There appears to be something wonky going on with the Window_OnLoad, GetWims and ParseFile subs. After adding my animation to the parsefile sub (so people could tell it was working when attempting to get wim info), I noticed it's actually running twice by default--something that's silly, and slows down the HTA. The culprit seems to be a bit of code in the GetWims sub that appears unnecessary. Here is the sub:

Sub GetWims(myList())
	Dim FSO, strSelectedFolder, strFileList, ObjFile
	Set FSO = CreateObject("Scripting.FileSystemObject")
	On Error Resume Next
	Set strSelectedFolder = FSO.GetFolder(myFilepath)
	If Err.number <> 0 Then
		Call Browse()
	End If
	Set strFileList = strSelectedFolder.Files
	For Each objFile in strFileList
		If Lcase(Right(objFile.Name,4)) = ".wim" Then
			myList(Ubound(myList)) = objFile.Name
			Redim Preserve myList(Ubound(myList)+1)
		End If
	Next
	If Ubound(myList)>0 Then
		Redim Preserve myList(Ubound(myList)-1)
	End if
	On Error Goto 0
End Sub

The offender comes right after "Set strSelectedFolder = FSO.GetFolder(myFilepath)," and looks like this (since I do not seem to be able to highlight in the code tags):
	If Err.number <> 0 Then
		Call Browse()
	End If

The problem is, since GetWims is run automatically on start, the first run will necessarily result in an error (since no wims have been selected) and GetWims will automatically open browse and ask for you to specify a wim. If it stopped there, that would be fine. However, in order for the info browse allows GetWims to pull to show up in the main window, Window_OnLoad has to be run again. So, what you end up with is Window_OnLoad being called from within a sub that was called from Window_OnLoad. And, since Window_OnLoad calls ParseFile, ParseFile (as part of Window_OnLoad) gets run once by GetWims, and then again by the rest of Window_OnLoad. This leads to the HTA taking twice as long as it should to get information from a wim selected when the hta is first opened because the info command gets run twice.

So far, the only way I've found to untangle this mess is to remove the error browse call from GetWims. The fact that it's there in the first place is somewhat strange in that browse will only ever let you select a .wim, so the chances of GetWims erring out due to a legitimate error that needs addressing by re-running browse is incredibly unlikely.

So ya, if anyone else has an idea that somehow untangles the mess without removing the GetWims error call, I'd love to hear it, but as of now it seems completely unnecessary, and actually slows everything down.

#56
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

I do not see this behaviour happening. The Window_OnLoad that is run from browse is only run after a path is selected. I strive to never actually let techs see that Browse box to begin with. Its primarily a sign of trying to use incompatible hardware with the platform.

Potentially, you could try changing the Window_Onload in Browse() to use the Reload() sub instead.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#57
crowe80

crowe80

    Newbie

  • Member
  • 39 posts
  • Joined 13-March 12
  • OS:Windows 7 x64
  • Country: Country Flag
I've tried all these suggestions which were all good, but no luck. I'm not sure what's up with this device :(

#58
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

Not going to make a new thread for WinPE4 since it isn't too different. The build of the PE is the same as WinPE3 with some exceptions.

- You can add Powershell package
- You don't need to use the set-resolutionx64 (not compatible) and WinPE4 should set resolution to the optimal it thinks the display can use... I didn't test setres.exe because I don't work with 32bit WinPE anymore.
- WinPE4 does not have BCDBoot.exe in it by default, so you will need to copy this in additonally.

NOTE: You cannot use the basic functions of this HTA to work with Windows 8 or Server 2012 images. Imagex.exe does not do the job unforuntately. This still works with previous OSes the same. You'll have to manually use DISM to capture/deploy Windows 8 images!
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#59
robinmke

robinmke
  • Member
  • 4 posts
  • Joined 02-January 13
  • OS:Windows 7 x64
  • Country: Country Flag
I have the v.71 .ZIP file with the ImageX stuff that I'm trying to implement for a project.

The "Decompiler" is no longer part of the AutoIT scripting package :( to do the x64 thing.

As such I can't decompile the Browse.exe program to make some modes I want to do with it.

I'm trying to re-create it with the AutoIT scripting package, but having some problems getting it to all work - I'm in a bit of a time crunch, so not much time to learn the Ins & Outs of AutoIT yet.

Does anyone have the Script that was Decompiled from Browse.exe ??

Thanks in Advance

Rob in Milwaukee

#60
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

The "Decompiler" is no longer part of the AutoIT scripting package :( to do the x64 thing.

As such I can't decompile the Browse.exe program to make some modes I want to do with it.


I believe that I have included the 64bit browse.exe in the 7.3 download.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#61
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

If you try using this on WinPE4 x64 and do a UEFI boot via CD/DVD or PXE (or whatever) you'll find that everything is thrown off regarding pictures and text size. This is because WinPE4 can detect the native resolution of the display and will use GOP mode to automatically set the resolution. I have just tested a method of using ZOOM in javascript in a test HTA that you can use in this case.

Add the following Javascript code to a script element. I placed mine after the Script end tag for the VBScript code.

<script TYPE="text/javascript">
function pageLoadFunctions()
{
document.body.style.zoom = screen.height / 768;
}
</SCRIPT>

Then I change the BODY tag:

<BODY ONLOAD="pageLoadFunctions()">

It isn't 100% perfect, the right side of the HTA's background image is cut off but overall it is better.

Edit: This works fine on a 4:3 display. It leaves a large white space on the right side if using a 16:9 display and 1024x768. This is caused by the wallpaper background image.

Edited by Tripredacus, 31 May 2013 - 07:58 AM.

MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#62
MadFly1

MadFly1
  • Member
  • 7 posts
  • Joined 31-May 13
  • OS:Windows 7 x64
  • Country: Country Flag
Hi, Thanks to everyone who contributed to this project... I only VERY recently started playing around with winPE, and came across this forum.
Currently like the v7.3 the most, and was wondering if there was a way that I can use both 32bit and 64bit PE HTA at the same time?

I assume the reason they are in separate folders, is because you have to run either one of them... is there perhaps a way that i can put both on a flash drive, which will be my winPE, and then either run 32bit PE or 64bit...
I also assume that the 32bit PE is to deploy and capture 32bit OS, and 64bit PE is to deploy and capture 64bit OS.

Would be nice to have one HTA which can deploy/capture either 32bit or 64bit, or do i completely misunderstand the whole idea behind this project?

#63
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

64bit WinPE can do both, its the only one I actually use.

The only problems with 64bit WinPE is that the client needs a 64bit CPU to boot. Also requires nearly 1GB RAM (its less than that but I don't know how to test it) 99% of the time and 2GB on some boards with RAID enabled.

In other news, I've been working on trying to get the HTA to deploy via UEFI but it isn't working out yet. As it stands, this HTA can't deploy to UEFI and it can't deploy Windows 8. :(
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#64
MadFly1

MadFly1
  • Member
  • 7 posts
  • Joined 31-May 13
  • OS:Windows 7 x64
  • Country: Country Flag
excellent.

I have configured for myself a virtual environment (hyper-V) where i can play with this hta thing.
Works great so far, but for some reason when i try to apply the captured image to a new virtual pc, it complains that the bootmgr is missing.

Is there a way that I can capture the boot partition as well, or should i create it manually? Or could I somehow implement a button or two in the diskpart options?

Once I get this to actually work, i'll start playing around with adding drivers to the wim and a few other things i would like to try. but for now the capture and apply is more crucial.

Edited by MadFly1, 03 June 2013 - 03:58 AM.


#65
MadFly1

MadFly1
  • Member
  • 7 posts
  • Joined 31-May 13
  • OS:Windows 7 x64
  • Country: Country Flag


nothing.... :realmad:

the progress bar not run...
i have the same grey rectangle...

i make all the steps , gimagex x64 , startnet.cmd , and all packages..mhta...etc...

nothing :(

i don't understand where is MY error...


The current code in this is still the same as v7.1 except for the code changes mentioned in this thread. So the progress bar code is still incorrect, and as such, does not work for anyone. So its not your error, no one sees the progress bar. It is good enough to see the square, on some video cards/motherboards, no rectangle appears at all! Anyways, you will know when it is done because it shows you a prompt after applying the image.


How would one go about replacing that whole progress sub with an animated picture "loading.gif"?

#66
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

Uggg apparently there was a database rollback and my reply to this was lost. I will post again on Monday and see if I can reconstruct that reply. :(
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#67
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,845 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

To the best of my knowledge, the gray rectangle is from either one of these subs, right at the very end of the VBScript.

Sub objWIM_Progress(Percent,TimeRemaining)
On Error Resume Next
objShell.Popup Percent, 1, "Title", -1
If Percent = 100 Then
progress.innerHTML = "<table border='0'><tr><td>Percents completed: </td><td>100 % </tr><tr><td>Time remaining: </td><td>0 min 0 sec</td></tr></table>"
Exit Sub
Else
Call ProgressHelper(Percent,TimeRemaining)
End If

End Sub

Sub ProgressHelper(pr,tr)
On Error Resume Next
intFMin = (tr MOD 3600) \ 60
intFSec = (tr MOD 3600) MOD 60
progress.style.visibility = "visible"
progress.innerHTML = "<table border='0'><tr><td>Percents completed: </td><td>" & pr & "%" & "</td></tr><tr><td>Time remaining: </td><td>" & intFMin & " min " & intFSec & " sec</td></tr></table>"
If pr = 100 Then
window.clearInterval(iTimerID)
progress.innerHTML = "<table border='0'><tr><td>Percents completed: </td><td>100 % </tr><tr><td>Time remaining: </td><td>0 min 0 sec</td></tr></table>"
Else
Exit Sub
End If

End Sub

As a way to replace that, I can think maybe change it to show a pop-up HTA similar to the Diskpart/format select screen, but instead the HTA would be fairly simple and have a Style Body object that has this:

background-image:url('resources\imagex.gif')

This is only an example. If you have any questions relating to VBScript, ask them here:
http://www.msfn.org/...s-cmdbatch-etc/
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users