October 11, 200718 yr Thanks for sharing. I've taken a lot of the code into my own HTA but again I'm a newbie at this. Can someone help me or point me to the correct direction on how to change the background image when an option is chosen from using a radio button? Here is my situation:I added two(radio) buttons that say (development and production) to readily distinguish the environment that they are going to get the image from. My problem is I cannot change the background image (am totally inexperience in html or hta) defined in <DIV>. Can someone please help me on how to do this? What I am doing is this:strBody = strBody & "<td><Input type=radio name=envList checked value=Production onclick=ChangeBG>" &_ "Production" & "</BUTTON><BR>"strBody = strBody & "<Input type=radio name=envList value=Development onclick=ChangeBG>" &_ "Development" & "</BUTTON></td>"sub changeBG...end subIs it possible to change it this way? What am I suppose to put in the "changeBG" to change the SRC?Thank you very much.You guys rock!!!
October 12, 200718 yr strBody = strBody & "<td><Input type=radio name=envList checked value=Production onclick=proBG>" &_"Production" & "</BUTTON><BR>"strBody = strBody & "<Input type=radio name=envList value=Development onclick=devBG>" &_"Development" & "</BUTTON></td>"Sub proBG bg.InnerHTML = "<img src='probg.bmp'>"End SubSub devBG bg.InnerHTML = "<img src='devbg.bmp'>"End Sub
October 19, 200718 yr What I'm finding is that whenever I attempt to launch a command line - for example, the entire "ghost32.exe -mode=load src=c:\image.gho etc..." it fails.Usually I get a "the user cancelled this command" or something like that.It seems to be related to the use of spaces in the variables building the command. I can launch the executable itself without issue, but try to add the switches to it and it fails.
October 23, 200718 yr t:\Programs\ghost11\files\ghost32.exe -clone,mode=restore,src=k:\images\sample.gho,dst=1If I run just the executable part (t:\Programs\ghost11\files\ghost32.exe) it runs fine. Once I add the switches, it fails.
October 23, 200718 yr I am just floored right now, this is exactly what I need for our manufacturing environment. We currently use a DOS based imaging setup which was old when we created it, now it's up to me to bring our imaging up to the 32-bit standard. I am so pumped to find all this information, its going to take me a while to take it all in but I just wanted to pop up and say wow.
October 23, 200718 yr t:\Programs\ghost11\files\ghost32.exe -clone,mode=restore,src=k:\images\sample.gho,dst=1If I run just the executable part (t:\Programs\ghost11\files\ghost32.exe) it runs fine. Once I add the switches, it fails.You're missing the last part of the clone command, the sze parameter.
October 24, 200718 yr t:\Programs\ghost11\files\ghost32.exe -clone,mode=restore,src=k:\images\sample.gho,dst=1If I run just the executable part (t:\Programs\ghost11\files\ghost32.exe) it runs fine. Once I add the switches, it fails.You're missing the last part of the clone command, the sze parameter.While that may be - and likely due to me just leaving it off when typing my reply - it doesn't solve the issue I'm having.
October 24, 200718 yr Ok I've read some more and I think I was wrong about the sze switch as it is not necessarily needed, but still think the error is in the syntax of your switch. I've searched and I cannot find a mode=restore. There is a mode=prestore or mode=load. The prestore mode restores a specific partition and the load mode restores the entire disk. Heres a link to the -clone syntax. Switches: Cloning
October 24, 200718 yr Let's try this again:t:\Programs\ghost11\files\ghost32.exe -clone,mode=load,src=k:\images\sample.gho,dst=1The above string, when passed to be run by the click of a button, does not work.
October 24, 200718 yr Ok, I'm at a loss. Can you post the code as you are using it in your HTA? It would give me a better idea of the context in which you are trying to run the command. Edited October 24, 200718 yr by zorphnog
October 24, 200718 yr It's the original wizard.hta script, with my ghost32.exe locations...<html><!--'********************************************************************'*'* File: wizard.hta'* Author: greg & fisher'* Created: Mar 2007'* Modified:'* Version: .9'*'* Description: windows imaging platform'*'* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,'* XML, HTA packages'* Notes: Line 26 - might want to make this "normal" when you are'* testing and don't want the hta fullscreen'* Line 58 - customize your headings here'* Line 72, 101 - confirm directory.name path, this would be a mapped'* drive to the filer where the images shorcut dir is'* Line 193 - confirm background image source location'* Line 200 - confirm path to ghost executable'*'********************************************************************--><!****************************************************************************><!* HTA Header ><!****************************************************************************><HEAD><TITLE>Imaging Application</TITLE><HTA:APPLICATIONBORDER = NoneAPPLICATION = YesWINDOWSTATE = normalINNERBORDER = NoSHOWINTASKBAR = YesSCROLL = NoAPPLICATIONNAME = "Windows PE Wizard"NAVIGABLE = Yes><!-- external stylesheet --><link rel="stylesheet" type="text/css" href="htaStyle.css" /></HEAD><!****************************************************************************><!* Begin Script ><!****************************************************************************><script Language=VBScript>'****************************************************************************'* Globals'* setup global script parameters'****************************************************************************Option ExplicitDim strTaskValue, objShell, objFso, strBody, objWmiServiceSet objShell = CreateObject("WScript.Shell")Set objFso = CreateObject("Scripting.FileSystemObject")Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")'****************************************************************************'* Window_OnLoad'* load up behavior and preferences'****************************************************************************Sub Window_Onloadself.Focus()strBody = "<H1>PE Build and Recovery Environment</H1>" &_"<H2>Select Images to apply an OS image using Ghost.<BR><BR>" &_"Please select an image category:<BR><BR>"enumDirsEnd Sub'****************************************************************************'* enumDirs'* find directories and create category buttons'****************************************************************************Sub enumDirsDim colSubfolders, objFolder, fileName'enumerate folders in images folderSet colSubfolders = objWMIService.ExecQuery _("Associators of {Win32_Directory.Name='z:\winpe'} Where AssocClass = Win32_Subdirectory ResultRole = PartComponent")'create html buttons from each folder nameFor Each objFolder in colSubfoldersfileName = objFolder.fileNamestrBody = strBody &_"<button id='" & fileName & "' onClick='enumImages("" & fileName & "")'>" & fileName & "</BUTTON>"Next'post resulting html body to documentstrBody = strBody & "<BR><HR><BR>"body.innerHTML = strBodyEnd Sub'****************************************************************************'* enumImages'* find images and create radio buttons'****************************************************************************'this sub is a little messy because of limitations of win32_shortcutfile and need to go between fso and wmi for different info'also, without the advantages of .net sorting classes, the old bubble sorting is not the funnestSub enumImages(fileName)Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItemReDim arrButtons(1,-1)'reset display element styledetails.innerHTML = ""details.style.visibility = "hidden"' strButtons = "<table id=buttonTable>"'enumerate ghost image shortcuts in specific images subfolder from enumDirsSet colFileList = objWMIService.ExecQuery _("ASSOCIATORS OF {Win32_Directory.Name='z:\winpe\" & fileName & "'} Where ResultClass = CIM_DataFile")'find ghost image shortcut targetpath (fso)For each objFile in colFileListIf objFile.Extension = "lnk" ThenSet objShortcut = objShell.CreateShortcut(objFile.name)'find ghost image shortcut target (wmi)Set colTargetList = objWMIService.ExecQuery _("Select * from CIM_Datafile Where name = '" & replace(objShortcut.targetpath,"\","\\") & "'")'add radio button label (from fso) and radio button target (from wmi) to an arrayFor each objTarget in colTargetListReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)arrButtons(0,UBound(arrButtons,2)) = objShortcut.DescriptionarrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & objTarget.Drive & objTarget.Path &objTarget.fileName &_"' onClick=showRadioInfo>" & objShortcut.Description & "</BUTTON><BR>"NextEnd IfNext'perform a a shell sort of the string array based on button labelFor x = 0 To UBound(arrButtons,2) - 1For y = x To UBound(arrButtons,2)If StrComp(arrButtons(0,x),arrButtons(0,y),vbTextCompare) > 0 ThenstrKey = arrButtons(0,x)strItem = arrButtons(1,x)arrButtons(0,x) = arrButtons(0,y)arrButtons(1,x) = arrButtons(1,y)arrButtons(0,y) = strKeyarrButtons(1,y) = strItemEnd IfNextNext'create combined buttons html code from sorted buttons arrayFor x = 0 To UBound(arrButtons,2)strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"Next' strButtons = strButtons & "</table>"'create a start button with start image command and append and post resulting html to bodybody.innerHTML = strBody & strButtons & "<BR><HR><BR><button id=start Accesskey=S onclick=doTask(strTaskValue)><U>S</U>tartImage!</BUTTON><BR>"start.style.visibility="hidden"End Sub'****************************************************************************'* doTask'* run task selected by radio button'****************************************************************************Sub doTask(doMe)objShell.Run doMeEnd Sub'****************************************************************************'* showRadioInfo'* display details of radio button selection in details divider'****************************************************************************Sub showRadioInfoDim objTextFile, Radio, strRadioValue, strDetails'set details and start element stylesdetails.style.visibility = "visible"start.style.visibility = "visible"'find checked buttonFor Each Radio in Document.getElementsByName("radioList")If Radio.Checked = True Then'create imaging command line from button idstrTaskValue = Chr(34) & "t:\Programs\ghost11\files\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) &Radio.Id & ".gho" & Chr(34) & ",dst=1"'display image details in details element if they existIf objFso.FileExists(Radio.Id & ".htm") ThenSet objTextFile = objFso.OpenTextFile(Radio.Id & ".htm", 1)strDetails = objTextFile.ReadAll()Else'display error message in details element if no matching details file foundstrDetails = "Can't find anything!!!<BR><BR>" &_"Make sure the info file has the same name as the .gho and has an .htm extension."End IfEnd IfNext'post resulting html to details elementDetails.innerHTML = strDetailsEnd Sub'****************************************************************************'* Reset'* reset the tool interface, also reloads the code (helpful for programming)'****************************************************************************Sub ResetLocation.Reload(True)End Sub</Script><!****************************************************************************><!* End Script / Begin HTML ><!****************************************************************************><BODY><DIV id=bg><img src=winpe.bmp></DIV><DIV id=body></DIV><DIV id=details></DIV><DIV id=tools><Button id=ghost onclick=doTask('"t:\Programs\ghost11\files\ghost32.exe"')>Ghost</BUTTON><Button id=cmd onclick=doTask('%comspec%')> Cmd </BUTTON><Button id=notepad onclick=doTask('notepad')> Notepad </BUTTON><Button id=taskmgr onclick=doTask('taskmgr')> Taskmgr </BUTTON><Button id=close onclick=self.close()> Quit </BUTTON><Button id=reset onclick=reset> ResetApp </BUTTON><Button id=reboot onclick=self.navigate('reboot.hta')> Reboot </BUTTON></DIV></BODY></HTML><!****************************************************************************><!* End HTML ><!****************************************************************************>This is the snippet that creates the string that should get launched by the button:'find checked buttonFor Each Radio in Document.getElementsByName("radioList")If Radio.Checked = True Then'create imaging command line from button idstrTaskValue = Chr(34) & "t:\Programs\ghost11\files\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1"
October 26, 200718 yr Many Thanks for sharing keythom, I'm just getting into HTAs and yours is very cool!
November 6, 200718 yr i love this hta menu. i use it on my software imaging recovery program but i need help on it. i used a 2 different recovery program, how can i used the button to distinguish which program to used to reload the image. for example image a, image b, image c use a recovery software image d, image e, image f uses another recovery softwarei want to use this menu to keep it simple for my techs. any ideas or sugesstion or how to code properly.remind you that i am total noobie at this. i have general idea how it works but not to code it ... any ideas would appreciatedthanks
Create an account or sign in to comment