obiwantuxedo

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About obiwantuxedo

  1. Here is the code I added for the capture, but only gives me one prompt instead of the the three: Under the <script ...> '**************************************************************************** '* Capture Image '**************************************************************************** Sub RunScript strDrv = window.prompt("Please enter the drive letter you would like to capture.", "Drive Letter") strWimFile = window.prompt("Please enter the name for the captured image.", "Image Name") strWimDesc = window.prompt("Please enter the make and model, i.e. Dell Latitude D820.", "Description") 'Test purposes only!!! Msgbox "IMAGEX /CAPTURE "& strDrv &" " & strDrv & "\"& strWimFile & " " &chr(34) & strWimDesc &chr(34) & " /verify /compress maximum" End Sub Under <BODY ...> <input id="runbutton" class="button" type="button" value="Capture" name="run_button" onClick="RunScript"> Like I said before, when I run this exact code in an HTA of its' own, it works. Cut and paste into this HTA, and I only receive one prompt.
  2. Here's what I've got... <!****************************************************************************> <!* HTA Header > <!****************************************************************************> <HEAD> <TITLE>ImageX Deployment</TITLE> <HTA:APPLICATION BORDER = yes APPLICATION = Yes WINDOWSTATE = MAXIMIZE INNERBORDER = No SHOWINTASKBAR = Yes SCROLL = yes APPLICATIONNAME = "Windows PE Wizard" NAVIGABLE = Yes > <!-- external stylesheet --> </HEAD> <!****************************************************************************> <!* Begin Script > <!****************************************************************************> <script Language=VBScript> '**************************************************************************** '* Globals '* setup global script parameters '**************************************************************************** Option Explicit Dim strTaskValue, objShell, objFso, strBody, objWmiService, strImgSrc, strOutPut, cmdImgInfo, cmdPartHD, tmpFile, j, strImages, strLocation Dim strIndx(), strNames() Set objShell = CreateObject("WScript.Shell") Set objFso = CreateObject("Scripting.FileSystemObject") 'Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2") '-------------- Editable commands -------------- ' Diskpart command cmdPartHD = "%comspec% /c diskpart /s z:\diskpart.txt" ' Image-X /info command. (xml-print) cmdImgInfo= "%comspec% /c imagex /info z:\Image62.wim" ' Default file, where to parse image list strImages = "z:\images.txt" '------------------------------------------------ '**************************************************************************** '* Run Ghost is necessary '**************************************************************************** Sub RunGhost32 Set objShell = CreateObject("Wscript.Shell") objShell.Run ".\Ghost32.exe" End Sub '**************************************************************************** '* Window_OnLoad '* load up behavior and preferences '* Read image files '* Parse indexes and filenames '**************************************************************************** Sub Window_Onload readImages() strLocation = strImages 'InputBox("Path to images.txt file:", "images.txt" , strImages) Call parseFile(strIndx, strNames, strLocation) self.Focus() strBody = "<BR><font face=verdana><B>Select image to apply:</B></font><BR>" enumDirs End Sub '**************************************************************************** '* enumDirs '**************************************************************************** Sub enumDirs Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem, k ReDim arrButtons(1,-1) 'Reset display element style details.innerHTML = "" details.style.visibility = "hidden" 'Create list For k = 0 To Ubound(strIndx) ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1) arrButtons(0,UBound(arrButtons,2)) = strNames(k) arrButtons(1,UBound(arrButtons,2)) = "<font face=verdana><Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</font></BUTTON><BR>" 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 'End of the list For x = 0 To UBound(arrButtons,2) strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>" Next strBody = strBody & "<BR><HR><BR>" strBody = strBody & strButtons & "<BR><HR><BR><button class='defBtn' id=start Accesskey=S onclick=doTask(strTaskValue)><U>A</U>pply</BUTTON> <Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>" body.innerHTML = strBody End Sub '**************************************************************************** '* doTask '* run task selected by radio button '**************************************************************************** Sub doTask(doMe) Dim myInput Dim myError If doMe = "" Then MsgBox "You must choose image to apply first." Else If Instr(1, doMe, "gex /apply", 1) > 0 Then myInput = MsgBox("The hard disk of the computer will be formatted and the image will be applied to it."+Chr(13)+Chr(13)+"Continue?", 4) If myInput = 7 Then MsgBox "Aborted by user" Else doTask(cmdPartHD) objShell.Run doMe End if Else myError = objShell.Run(doMe, 1, True) End if End if End Sub '**************************************************************************** '* readImages '* Imagex info-print -> file '**************************************************************************** Sub readImages() 'ObjShell.Run "%comspec% /c Dir " & chr(34) & strImgSrc & chr(34) & " > " & chr(34) & strOutPut & chr(34) ' Imagex /Info command ' ObjShell.Run "%comspec% /c " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34) ' objShell.Run cmdImgInfo & " > " & strImages End Sub '**************************************************************************** '* parseFile '* Parses the text inside <name> and <index> tags from text file. '**************************************************************************** Sub parseFile(strIndx(), strNames(), strFile) Dim objTextFile, sReadLine, pos, pos2, i, tmpStr1 i = -1 Redim strNames(0) Redim strIndx(0) If objFso.FileExists(strFile) Then Set objTextFile = objFso.OpenTextFile(strFile, 1) Do While Not objTextFile.AtEndOfStream sReadLine = objTextFile.ReadLine ' indexit ja name haltuun pos2 = Instr(1, sReadLine, "<IMAGE", 1) pos = Instr(1, sReadLine, "<NAME>", 1) If pos2 > 0 Then i = i + 1 Redim Preserve strIndx(i) Redim Preserve strNames(i) 'strIndx(i) = Right(sReadLine, Len(sReadLine) - (pos2 + 9)) tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13)) strIndx(i) = Left(tmpStr1, Len(tmpStr1) -2) End If If pos > 0 Then 'strNames(i) = Right(sReadLine, Len(sReadLine) - (pos + 5)) tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5)) strNames(i) = Left(tmpStr1, Len(tmpStr1) -8) End If loop End If End sub '**************************************************************************** '* showRadioInfo '**************************************************************************** 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 = "imagex /apply z:\Image62.wim " + Radio.Id + " c:" End If Next 'post resulting html to details element Details.innerHTML = "<BR><font face=verdana><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table></font><BR>" End Sub '**************************************************************************** '* Reset'* reset the tool interface, also reloads the code (helpful for programming) '**************************************************************************** </Script> <!****************************************************************************> <!* End Script / Begin HTML > <!****************************************************************************> '<BODY background="pe.jpg"> <table width=739 height =128 background=./masthead.jpg><tr><td align=center valign=bottom><font face=verdana color=white><b>ImageX Deployment Menu</b></font></td></tr></table> <DIV id=bg> <!-- <img src="K:\WinPE\pe.jpg"> --> </DIV> <DIV id=body></DIV> <DIV id=details></DIV> <DIV id=tools> </DIV> <br> <table border="0" width="737"> <tr> <td bgcolor="#000000" > <p align="center"><font face="Verdana" color="#FFFFFF"><b> Symantec Ghost</b></font></td> </tr> <tr> <td ><font face="Verdana" size="2">If all else fails, you can use Ghost to image a workstation. You will need to know the path to the image or call the Help Desk (x4-5666) to setup a Multicast session.</td> </tr> <tr> <td> </td> </tr> <tr> <td><font face="Verdana" size="2"><font face = Verdana> <input id=runbutton3 class="button" type="button" value="Ghost32" name="btnGhost32" onClick="RunGhost32"></font></td> </tr> </table> </BODY> </HTML> <!****************************************************************************> <!* End HTML > <!****************************************************************************> So far the response from my techs and other SAs has been great. Again, thanks.
  3. Thanks for the HTA. This is exactly what I started last week. Yours, however, is an improvement over what I had started. I have added the Ghost32 capability for my techs to use should an ImageX image not be available. I am looking for a section that also allows for capture/append so we can create the ones we don't have. Any suggestions? I have started one that works in a separate HTA file, but when I add it to yours, it fails, only prompting for the first parameter (Drive to capture) the other two, WIM file name and description never appear. I'll post code tomorrow, left it at work. Also, your link to the sample files isn't working. Thanks again!