Jump to content

thebearpoo

Member
  • Posts

    7
  • Joined

  • Last visited

  • Donations

    $0.00 
  • Country

    United States

Posts posted by thebearpoo

  1. Anybody get the /compress flag to work with this app? If I add the bold text command, it does not compress to the maximum compression rate. It just does a fast compression.

    ObjShell.Run "%comspec% /c imagex /compress max /capture "& strDrv &" " & SavePath & strWimFile & " " &chr(34) & strWimDesc &chr(34), 1, True

    If I manually run the command "imagex /compress max /capture C: C:\test.wim "test image"", the maximum compression rate it applied.

  2. geezer - I get the same result in ver 2.1, after diskpart completes nothing happens. If I substitute this code(which is posted on page 2) the apply button works perfectly.

    '****************************************************************************
    '* showRadioInfo
    '* display details of radio button selection in details divider
    '****************************************************************************
    Sub showRadioInfo
    Dim objTextFile, Radio, strRadioValue, strDetails, objSel1, strFile

    Set objSel1 = window.document.getElementById("select1")
    strFile = myFilePath + objSel1.options(objSel1.selectedindex).text

    details.style.visibility = "visible"
    start.style.visibility = "visible"
    For Each Radio in Document.getElementsByName("radioList")
    If Radio.Checked = True Then
    strTaskValue = "imagex /apply " + strFile + " " + Radio.Id + " c:"
    End If
    Next
    Details.innerHTML = "<BR><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table><BR>"
    End Sub

    ccb458 - How did you call your Reboot option using a cmd.bat file to restart your computer after imagex runs?

  3. Thanks for the source code. I need some help though, I am getting an error message after my diskpart runs and exits.

    Error is -

    Line: 140

    Char: 4

    Error: The system cannot find the specified file.

    Code: 0

    URL: file:////X:/windows/system32/tools/hta/ImageXHTA.hta

    diskpart.txt, install.wim, and images.txt are all located in a network drive that is mapped using the net use command before the ImageXHTA.hta apps is launched in WINPE 2.0. ImageXHTA.hta, htasyle.css, pe.jpg, and Update Image list.cmd are located in the windows\system32\tools\hta folder of the boot.wim file.

    Here is my code:

    <html>
    <!--
    '********************************************************************
    '*
    '* File: ImageXHTA.hta
    '* Author: geezery
    '* Big thanks to : greg & fisher
    '* Created: May 2007
    '* Version: .1
    '*
    '* Description: windows imaging platform
    '*
    '* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,
    '* XML, HTA packages, Imagex components
    '* Notes: Line 28 - might want to make this "normal" when you are
    '* testing and don't want the hta fullscreen
    '* Line 206 - Put your background image there if you want
    '********************************************************************
    -->

    <!****************************************************************************>
    <!* HTA Header >
    <!****************************************************************************>
    <HEAD>
    <TITLE>Imaging Application</TITLE>
    <HTA:APPLICATION
    BORDER = yes
    APPLICATION = Yes
    WINDOWSTATE = maximize
    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, 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 Q:\diskpart.txt"
    ' Image-X /info command. (xml-print)
    cmdImgInfo= "%comspec% /c imagex /info Q:\install.wim"
    ' Default file, where to parse image list
    strImages = "Q:\images.txt"
    '------------------------------------------------

    '****************************************************************************
    '* Window_OnLoad
    '* load up behavior and preferences
    '* Read image files
    '* Parse indexes and filenames
    '****************************************************************************
    Sub Window_Onload
    readImages()
    strLocation = InputBox("Path to images.txt file:", "images.txt" , strImages)
    Call parseFile(strIndx, strNames, strLocation)
    self.Focus()
    strBody = "<div id='title'>ImageX Deployment platform</div>" & "<BR><B>Select image to apply:</B><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)) = "<Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</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 image</BUTTON><BR>"

    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 Dir " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34)
    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 Q:\install.wim " + Radio.Id + " c:"
    End If
    Next
    'post resulting html to details element
    Details.innerHTML = "<BR><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table><BR>"
    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 background="pe.jpg">
    <DIV id=bg>
    <!-- <img src="pe.jpg"> -->

    </DIV>

    <DIV id=body></DIV>
    <DIV id=details></DIV>

    <DIV id=tools>
    <Button class = 'defBtn' id=cmd onclick=doTask('%comspec%')> CMD-Prompt </BUTTON>
    <Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>
    <Button class = 'defBtn' id=reset onclick=reset> Refresh List</BUTTON>
    </DIV>
    </BODY>
    </HTML>

    <!****************************************************************************>
    <!* End HTML >
    <!****************************************************************************>

    Here is my images.txt file



    ImageX Tool for Windows

    Copyright © Microsoft Corp. 1981-2005. All rights reserved.





    WIM Information:
    ----------------
    GUID: {1bf6a4c6-35cf-45a4-be1a-526c70946546}
    Image Count: 1
    Compression: XPRESS
    Part Number: 1/1
    Attributes: 0xc
    Integrity info
    Relative path junction


    Available Image Choices:
    ------------------------
    <WIM>

    <TOTALBYTES>2029827781</TOTALBYTES>

    <IMAGE INDEX="1">

    <NAME>Windows Vista Business</NAME>

    <FLAGS>Business</FLAGS>

    <WINDOWS>

    <ARCH>0</ARCH>

    <PRODUCTNAME>Microsoft® Windows® Operating System</PRODUCTNAME>

    <HAL>acpiapic</HAL>

    <PRODUCTTYPE>WinNT</PRODUCTTYPE>

    <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>

    <LANGUAGES>

    <LANGUAGE>en-US</LANGUAGE>

    <DEFAULT>en-US</DEFAULT>

    </LANGUAGES>

    <VERSION>

    <MAJOR>6</MAJOR>

    <MINOR>0</MINOR>

    <BUILD>6000</BUILD>

    <SPBUILD>16386</SPBUILD>

    </VERSION>

    <SYSTEMROOT>WINDOWS</SYSTEMROOT>

    </WINDOWS>

    <DIRCOUNT>6845</DIRCOUNT>

    <FILECOUNT>38059</FILECOUNT>

    <TOTALBYTES>7416098786</TOTALBYTES>

    <CREATIONTIME>

    <HIGHPART>0x01C79672</HIGHPART>

    <LOWPART>0x475F3C78</LOWPART>

    </CREATIONTIME>

    <LASTMODIFICATIONTIME>

    <HIGHPART>0x01C79672</HIGHPART>

    <LOWPART>0x48083E5F</LOWPART>

    </LASTMODIFICATIONTIME>

    </IMAGE>

    </WIM>

    Any ideas???



×
×
  • Create New...