Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


  • Content count

  • Donations

  • Joined

  • Last visited

Community Reputation

0 Neutral

About rafael901

Profile Information

  • OS
    Windows 7 x86
  1. WinPE 2.0 simple Ghost Menu HTA

    Has anybody adjusted this script to work in winpe 4.0?
  2. I did copy to my winpe image and used the X: drive to call the hta file with no luck. the shortcut image buttons to my hta file will not show up. Only the background and the buttons at the bottom of the file show up.
  3. I am also having problems running my hta from a network share. When I run it locally, it works just fine. When I try to run it form a network drive only the background and the buttons at the bottom of the script show up. The hta code is below. <HEAD> <TITLE>Imaging Application</TITLE> <HTA:APPLICATION BORDER = None APPLICATION = Yes WINDOWSTATE = normal INNERBORDER = No SHOWINTASKBAR = Yes SCROLL = No APPLICATIONNAME = "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 Explicit Dim strTaskValue, objShell, objFso, strBody, objWmiService Set objShell = CreateObject("WScript.Shell") Set objFso = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2") '**************************************************************************** '* Window_OnLoad '* load up behavior and preferences '**************************************************************************** Sub Window_Onload self.Focus() strBody = "<H1>CCC Lab Telephony imaging platform</H1>" &_ "<H2>Select Images to apply an OS image using Ghost.<BR><BR>" &_ "Please select an image category:<BR><BR>" enumDirs End Sub '**************************************************************************** '* enumDirs '* find directories and create category buttons '**************************************************************************** Sub enumDirs Dim colSubfolders, objFolder, fileName 'enumerate folders in images folder Set colSubfolders = objWMIService.ExecQuery _ ("Associators of {Win32_Directory.Name='Z:\imageshare\winpe'} Where AssocClass = Win32_Subdirectory ResultRole = PartComponent") 'create html buttons from each folder name For Each objFolder in colSubfolders fileName = objFolder.fileName strBody = strBody &_ "<button id='" & fileName & "' onClick='enumImages("" & fileName & "")'>" & fileName & "</BUTTON>" Next 'post resulting html body to document strBody = strBody & "<BR><HR><BR>" body.innerHTML = strBody End 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 funnest Sub enumImages(fileName) Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem ReDim arrButtons(1,-1) 'reset display element style details.innerHTML = "" details.style.visibility = "hidden" ' strButtons = "<table id=buttonTable>" 'enumerate ghost image shortcuts in specific images subfolder from enumDirs Set colFileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='z:\imageshare\winpe\" & fileName & "'} Where ResultClass = CIM_DataFile") 'find ghost image shortcut targetpath (fso) For each objFile in colFileList If objFile.Extension = "lnk" Then Set 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 array For each objTarget in colTargetList ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1) arrButtons(0,UBound(arrButtons,2)) = objShortcut.Description arrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & objTarget.Drive & objTarget.Path & objTarget.fileName &_ "' onClick=showRadioInfo>" & objShortcut.Description & "</BUTTON><BR>" Next End If Next 'perform a a shell sort of the string array based on button label For x = 0 To UBound(arrButtons,2) - 1 For y = x To UBound(arrButtons,2) If StrComp(arrButtons(0,x),arrButtons(0,y),vbTextCompare) > 0 Then strKey = arrButtons(0,x) strItem = arrButtons(1,x) arrButtons(0,x) = arrButtons(0,y) arrButtons(1,x) = arrButtons(1,y) arrButtons(0,y) = strKey arrButtons(1,y) = strItem End If Next Next 'create combined buttons html code from sorted buttons array For 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 body body.innerHTML = strBody & strButtons & "<BR><HR><BR><button id=start Accesskey=S onclick=doTask(strTaskValue)><U>S</U>tart Image!</BUTTON><BR>" start.style.visibility="hidden" End Sub '**************************************************************************** '* doTask '* run task selected by radio button '**************************************************************************** Sub doTask(doMe) objShell.Run doMe End Sub '**************************************************************************** '* showRadioInfo '* display details of radio button selection in details divider '**************************************************************************** Sub showRadioInfo Dim objTextFile, Radio, strRadioValue, strDetails 'set details and start element styles details.style.visibility = "visible" start.style.visibility = "visible" 'find checked button For Each Radio in Document.getElementsByName("radioList") If Radio.Checked = True Then 'create imaging command line from button id strTaskValue = Chr(34) & "z:\imageshare\ghost\ghost32.exe" & Chr(34) & " -clone,mode=restore,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1" 'display image details in details element if they exist If objFso.FileExists(Radio.Id & ".htm") Then Set objTextFile = objFso.OpenTextFile(Radio.Id & ".htm", 1) strDetails = objTextFile.ReadAll() Else 'display error message in details element if no matching details file found strDetails = "Can't find anything!!!<BR><BR>" &_ "Make sure the info file has the same name as the .gho and has an .htm extension." End If End If Next 'post resulting html to details element Details.innerHTML = strDetails End Sub '**************************************************************************** '* Reset '* reset the tool interface, also reloads the code (helpful for programming) '**************************************************************************** Sub Reset Location.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('"z:\imageshare\ghost\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 > <!****************************************************************************>
  4. WinPE 2.0 simple Ghost Menu HTA

    Can HTAs work properly if they are lauched from a mapped network drive? When I launch my HTA file from the local machine everthing works perfectly but nothing works when I launch it from a mapped drive.
  5. WinPE 2.0 simple Ghost Menu HTA

    It just states that there was an script error and that the script could not run. The error was not specific.
  6. WinPE 2.0 simple Ghost Menu HTA

    I was able to get the .hta file to work over the network except for the information in my .htm files does not show up. I created the files using excel and saved them as html files in my ghost images directory. All the category buttons show up and the radio button show up but the information in the .htm files does not show up on the side when I click one of my radio buttons. It just give an script error message and asks if I would like to continue. Any ideas on what's wrong?
  7. WinPE 2.0 simple Ghost Menu HTA

    I found the solution in another thread to the access denied problem but now I have an all white .hta file that comes up on my winpe image.
  8. WinPE 2.0 simple Ghost Menu HTA

    Ok, I just switched to winpe 2.0 instead of 3.0. But now I am getting the access denied problem when I call my .hta file from the mapped drive cmd.exe /c Mshta.exe z:\wizard.hta. Did anyone ever solve this problem? I do not want to use the X: system drive. I prefer to stick with the mapped network drive for editing purposes.
  9. WinPE 2.0 simple Ghost Menu HTA

    Now I have 2 all white boxes that pop up with nothing on them when I load the image. I have the HTA, Scripting, Legacy Setup packages added to the image. Does anybody know what code is changed in 3.0? Need Help to get this to work. Thanks
  10. WinPE 2.0 simple Ghost Menu HTA

    I am using winpe 3.0 and I did load the HTA and scripting package into it.
  11. WinPE 2.0 simple Ghost Menu HTA

    I attempted to run the wizard.hta but all I get is a box with nothing on it except the background and the buttons down at the bottom (Ghost, Quit, Reset App, ...etc) of the page which do not work. I have the z:\winpe directory with all my subdirectories inside it and all my shortcut links inside the subdirectories. Any help would be appreciated.