Jump to content
Sign in to follow this  
ImageXGUI

ImageX GUI with ProgressBar

Recommended Posts

ImageXGUI

I'm new to autoit but it seems to be very powerful. As a start I have created a GUI for ImageX with a working progress bar and additional features. The base code was provided by joshiieeii. (Thanks!) Please be aware that the coding isn't perfect as I'm not really familar with autoit or really much of a coder so forgive the messyness of the code. If people like it I will work on developing it more. I intend to develop it more at least for my benefit.

FYI - Some functions are still a work in progress but Mapping drives, Capturing and Applying images work correctly. Let me know what you think and if anyone has suggestions for improvment.

You will need the following files in addition to the script below for it to work.

DiskPartitioner <- Also requires Diskpart.exe

RTConsole

The following files from Microsoft's WAIK

ImageX.exe

wimfltr.sys

wimfltr.dll

wimgapi.dll

1. Copy all the files above into the same directory. (Extracting the zip files.)

2. Convert the autoIT code below to an ImageXGUI_v1-0.exe. (RTConsole.exe and DiskPartitioner.exe will be embedded in the coverted ImageXGUI_v1-0.exe so you don't need those files after compiling).

3. I have this running on WinPE 2.0 and from XPSP2.

#include <Constants.au3>
#include <GUIConstants.au3>
#include <Array.au3>
#include <Process.au3>
#include <String.au3>
#include <GuiTreeView.au3>
#include <Date.au3>

Dim $avDriveMapAdd[7]
$avDriveMapAdd[0]   = "Unknown Error"
$avDriveMapAdd[1]   = "Undefined / Other error"
$avDriveMapAdd[2]   = "Access to the remote share was denied"
$avDriveMapAdd[3]   = "The device is already assigned"
$avDriveMapAdd[4]   = "Invalid device name"
$avDriveMapAdd[5]   = "Invalid remote share"
$avDriveMapAdd[6]   = "Invalid password"

Dim $avPing [5]
$avPing[0] = "Unknown Error"
$avPing[1] = "Host is offline"
$avPing[2] = "Host is unreachable"
$avPing[3] = "Bad destination"
$avPing[4] = "Other errors"

; Global Settings
;
Global $line1
Global $line3
Dim $gCaptureSource
Dim $gCaptureDestination
Dim $gCaptureCompression
Dim $gCaptureFlags
Dim $gCaptureConfig
Dim $gCaptureBoot
Dim $gCaptureCheck
Dim $gCaptureName
Dim $gCaptureDescription

Dim $gApplySource
Dim $gApplyDestination
Dim $gApplyVerify
Dim $gApplyName
Dim $imageinfo
Dim $gMapLetter
Dim $gMapUser
Dim $gMapPassword
Dim $gMapShare
Dim $sIni = @ScriptDir & "\gimagex.ini"
Dim $res
Dim $foo
Dim $gCaptureDiag
Dim $gApplyDiag

;
;Check for ImageX required files
;
If FileExists(@ScriptDir & "\imagex.exe") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimfltr.dll") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimfltr.sys") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimgapi.dll") Then;File Found
Else
    Msgbox(4096,"ImageXGUI", "You are missing one of the required files in the current folder: " & @ScriptDir & @CRLF & "ImageX will not function without these files!" & _
    @CRLF & @CRLF & "imagex.exe" & @CRLF & "wimfltr.dll" & @CRLF & "wimfltr.sys" & @CRLF & "wimgapi.dll")
EndIf   

;
; Create the main GUI
;
GUICreate("GImageX - ImageX GUI Wrapper", 640, 380, -1, -1 )
$hTab = GUICtrlCreateTab(10, 10, 620, 355)
$BaseX = 20
$BaseY = 35


; Drive Map Tab

$hTab_0 = GUICtrlCreateTabItem(" Drive Map ")

$CurX = $BaseX
$CurY = $BaseY

$CurY = $CurY + 10
GuiCtrlCreateGroup("Drive Mapping", $CurX+10, $CurY, 580, 135)
$CurY = $CurY + 18

GUICtrlCreateLabel("Letter", $CurX+20, $CurY+3)
$hMapLetter = GUICtrlCreateCombo("F:", $CurX+85, $CurY, 100, 500, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")

$CurY = $CurY + 27
GUICtrlCreateLabel("UNC Path", $CurX+20, $CurY+3)
$hMapShareEdit = GUICtrlCreateInput("\\Server\Sharename", $CurX+85, $CurY, 300)

$CurY = $CurY + 27
GUICtrlCreateLabel("Username", $CurX+20, $CurY+3)
$hMapUserEdit = GUICtrlCreateInput("Domain.com\%Username%", $CurX+85, $CurY, 300)

$CurY = $CurY + 27
GUICtrlCreateLabel("Password", $CurX+20, $CurY+3)
$hMapPasswordEdit = GUICtrlCreateInput("Password", $CurX+85, $CurY, 300, -1, $ES_PASSWORD)

$hMapButtonGo = GUICtrlCreateButton("&Map!", $BaseX+500, $BaseY+290, 100)

; Capture Tab
;
$hTab_1 = GUICtrlCreateTabItem("  Capture  ")

$CurX = $BaseX
$CurY = $BaseY

; File Group
$CurY = $CurY + 10
GuiCtrlCreateGroup("WIM Image", $CurX+10, $CurY, 580, 155)
$CurY = $CurY + 18
GUICtrlCreateLabel("Source", $CurX+20, $CurY+3)
$hCaptureSourceEdit = GUICtrlCreateInput("", $CurX+85, $CurY, 300)
$hCaptureSourceBrowse = GUICtrlCreateButton("Browse", $CurX+395, $CurY-2)

$CurY = $CurY + 27
GUICtrlCreateLabel("Destination", $CurX+20, $CurY+3)
$hCaptureDestEdit = GUICtrlCreateInput("MyWim.wim", $CurX+85, $CurY, 300)
$hCaptureDestBrowse = GUICtrlCreateButton("Browse", $CurX+395, $CurY-2)

$CurY = $CurY + 27
GUICtrlCreateLabel("Compression", $CurX+20, $CurY+3)
$hCaptureCompression = GUICtrlCreateCombo("Maximum", $CurX+85, $CurY, 100, 500, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "Fast")

$CurY = $CurY + 27
GUICtrlCreateLabel("Name", $CurX+20, $CurY+3)
$hCaptureNameEdit = GUICtrlCreateInput("My Image Name", $CurX+85, $CurY, 300)

$CurY = $CurY + 27
GUICtrlCreateLabel("Description", $CurX+20, $CurY+3)
$hCaptureDescEdit = GUICtrlCreateInput("My Image Description", $CurX+85, $CurY, 300)

; Options Group
$CurY = $CurY + 40
GuiCtrlCreateGroup("Options", $CurX+10, $CurY, 580, 100)
$CurY = $CurY + 18

GUICtrlCreateLabel("/config", $CurX+20, $CurY+3)
$hCaptureConfigEdit = GUICtrlCreateInput("", $CurX+85, $CurY, 300)
$hCaptureConfigBrowse = GUICtrlCreateButton("Browse", $CurX+395, $CurY-2)

$CurY = $CurY + 27
GUICtrlCreateLabel("Switches", $CurX+20, $CurY+3)
$hCaptureFlagsEdit = GUICtrlCreateInput("", $CurX+85, $CurY, 300)

$CurY = $CurY + 27
$hCaptureBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX+20, $CurY)
$hCaptureCheckCheck = GUICtrlCreateCheckbox("/check", $CurX+190, $CurY)
$hCaptureDiagCheck = GUICtrlCreateCheckbox("Display ImageX Console Window", $CurX+260, $CurY)

$hCaptureButtonGo = GUICtrlCreateButton("&Capture!", $BaseX+500, $BaseY+290, 100)


;
; Apply Tab
;
$hTab_2 = GUICtrlCreateTabItem("  Apply  ")

$CurX = $BaseX
$CurY = $BaseY

; File Group
$CurY = $CurY + 10
GuiCtrlCreateGroup("WIM Image", $CurX+10, $CurY, 580, 205)
$CurY = $CurY + 18
GUICtrlCreateLabel("1. Source", $CurX+20, $CurY+3)
$hApplySourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX+85, $CurY, 300)
$hApplySourceBrowse = GUICtrlCreateButton("Browse", $CurX+395, $CurY-2)

$CurY = $CurY + 27
GUICtrlCreateLabel ("Input Image Number", $CurX+15, $CurY+30, 70, 30)
$hApplyName = GUICtrlCreateInput("1", $CurX+85, $CurY+30, 40, 20)
$hApplyNameBrowse= GUICtrlCreateButton("2. Poll Image Number", $CurX+15, $CurY+1)
$treeview = GUICtrlCreateTreeView ( 150, 90, 450, 120, BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$CurY = $CurY + 27
GUICtrlCreateLabel("Destination", $CurX+20, $CurY+103)
$hApplyDestEdit = GUICtrlCreateInput("", $CurX+85, $CurY+100, 300)
$hApplyDestBrowse = GUICtrlCreateButton("Browse", $CurX+395, $CurY+98)

; Options Group
$CurY = $CurY + 40
GuiCtrlCreateGroup("Options", $CurX+10, $CurY+100, 580, 50)
$CurY = $CurY + 18
Dim $hReboot = GUICtrlCreateCheckbox ( "Automatically Reboot", $CurX+20, $CurY+105, 125, 15)
$hApplyVerifyCheck = GUICtrlCreateCheckbox("/verify", $CurX+150, $CurY+105, 50, 15 )
$hApplyDiagCheck = GUICtrlCreateCheckbox("Display ImageX Console Window", $CurX+210, $CurY+105, 200, 15 )

Dim $hDPart = GUICtrlCreateButton ( "Partition/Format", $BaseX+390, $BaseY+290, 100)
$hApplyButtonGo = GUICtrlCreateButton("&Apply!", $BaseX+500, $BaseY+290, 100)

;
; Set Default Options
;
LoadSettings()
SettingsToGUI()
;
; The GUI message loop
;
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
       ; General Messages
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
           ; Capture Messages
        Case $msg = $hCaptureButtonGo
            DoCapture()
        Case $msg = $hCaptureSourceBrowse
            $sDir = BrowseForDirectory()
            if $sDir Then GUICtrlSetData($hCaptureSourceEdit, $sDir)
        Case $msg = $hCaptureDestBrowse
            $sFile = BrowseForWimToSave()
            if $sFile Then GUICtrlSetData($hCaptureDestEdit, $sFile)
        Case $msg = $hCaptureConfigBrowse
            $sFile = BrowseForConfig()
            If $sFile Then GUICtrlSetData($hCaptureConfigEdit, $sFile)

           ; Apply Messages
        Case $msg = $hDPart
            MsgBox(4144, "DiskPart GUI", "*** USE AT YOUR OWN RISK *** | *** USE AT YOUR OWN RISK ***" & @CRLF & @CRLF & _
            "      *You may need to reboot for the changes to take effect.*" & @CRLF & @CRLF & _
            "     If you just format a partition you do not need to reboot.")
            FileInstall("DiskPartitioner.exe", @ScriptDir & "\DiskPartitioner.exe")
            RunWait(@ScriptDir & '\DiskPartitioner.exe')
            FileDelete(@ScriptDir & "\Diskpartitioner.exe")
        Case $msg = $hApplyNameBrowse
            PollImage()
        Case $msg = $hApplyButtonGo
            DoApply()
        Case $msg = $hApplyDestBrowse
            $sDir = BrowseForDirectory()
            if $sDir Then GUICtrlSetData($hApplyDestEdit, $sDir)
        Case $msg = $hApplySourceBrowse
            $sFile = BrowseForWimToLoad()
            if $sFile Then GUICtrlSetData($hApplySourceEdit, $sFile)

         ; Drive Map Messages
        Case $msg = $hMapButtonGo
            DoMapping()

        Case Else
           ;;;
    EndSelect
WEnd

Exit


;
; FUNCTIONS
;

Func BrowseForDirectory()
    $sDir = FileSelectFolder("Select source folder", "")
    If StringRight($sDir, 1) = "\" Then $sDir = StringTrimRight($sDir, 1)
    Return $sDir
EndFunc


Func BrowseForWimToSave()
    $sFile = FileSaveDialog( "Select destination file", "", "WIM Files (*.wim)", 3)
    If @error Then Return ""
    
    If StringRight($sFile, 4) <> ".wIM" Then $sFile = $sFile & ".wim"

    Return $sFile
EndFunc


Func BrowseForWimToLoad()
    $sFile = FileOpenDialog( "Select source file", "", "WIM Files (*.wim)", 3)
    If @error Then Return ""

    Return $sFile
EndFunc


Func BrowseForConfig()
    $sFile = FileOpenDialog("Select config file", @ScriptDir, "INI files (*.ini)", 1)
    If @error Or StringRight($sFile, 4) <> ".ini" Then Return ""

    Return $sFile
EndFunc


Func DoCapture()
    $sCmd = '"' & @ScriptDir & '\imagex.exe"'
    
    If $gCaptureConfig <> "" Then $sCmd = $sCmd & ' /config "' & $gCaptureConfig & '"'
    
    If $gCaptureCompression = "fast" Then
        $sCmd = $sCmd & " /compress fast"
    Else
        $sCmd = $sCmd & " /compress maximum"
    EndIf
    
    If $gCaptureCheck = 1 Then $sCmd = $sCmd & " /check"
    If $gCaptureBoot = 1 Then $sCmd = $sCmd & " /boot"
    If $gCaptureFlags <> "" Then $sCmd = $sCmd & ' ' & $gCaptureFlags
    
;   $sCmd = $sCmd & ' /capture /scroll "' & $sDir & '" "' & $sFile & '"'
    $sCmd = $sCmd & ' /capture /scroll "' & GUICtrlRead($hCaptureSourceEdit) & '" "' & GUICtrlRead($hCaptureDestEdit) & '"'
    $sCmd = $sCmd & ' "' & GUICtrlRead($hCaptureNameEdit) & '" "' & GUICtrlRead($hCaptureDescEdit) & '"'
    If GUICtrlRead($hCaptureDiagCheck) = '1' Then
        $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW)
    Else
        $ret = ShowProgress($sCmd, 'Capturing...')
    EndIf
   ;$ret = RunWait($sCmd, @WorkingDir, @SW_SHOW)
    If $ret = '0' Then
        SplashTextOn ( 'ImageX Status', 'Image Successfully Created!', 400, 50, -1, -1, 32, "Tahoma", 14, 500)
        Sleep (3000)
        SplashOff ()
    Else
        SplashTextOn ( 'ImageX Status', 'ImageX.exe ERROR : ' & $ret, 400, 50, -1, -1, 32, "Tahoma", 14, 500)
        Sleep (5000)
        SplashOff ()
    EndIf

EndFunc

Func PollImage ()
    Dim $nitem
    Dim $imageinfo = " "
    $read = GUICtrlRead ($hApplySourceEdit)
    $sCmd = "imagex.exe"
    If $read = "" Then
        MsgBox (48, "Input required", "Please select the source")
    Else
        $sCmd = $sCmd & ' /info "' & $read & '"'
    EndIf
   ;MsgBox(0, "scmd", $sCmd)
    Dim $ret = Run(@ComSpec & " /c " & $sCmd & '"', @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD )
    While 1
    $line = StdoutRead($ret)    
    If $line = "" Then  ExitLoop
    $imageinfo = $imageinfo & $line
;   MsgBox(0, "RunDOS", $line)
    If @error Then ExitLoop
    WEnd
     _GUICtrlTreeViewDeleteAllItems ($treeview)
    $aImageInfo = _StringBetween ( $imageinfo, "<NAME>", "</NAME>" )
        If @error Then $aImageInfo = _ArrayCreate("<Empty>")
    $aImageDesc = _StringBetween ( $imageinfo, "<Description>", "</Description>" )
        If @error Then $aImageDesc = _ArrayCreate("<Empty>")
    $aImageFileCount = _StringBetween ( $imageinfo, "<Filecount>", "</Filecount>" )
        If @error Then $aImageFileCount = _ArrayCreate("<Empty>")
   ;$aImageBuild = _StringBetween ( $imageinfo, "<Build>", "</Build>" ) 
;   If @error Then $aImageBuild = _ArrayCreate("<Empty>")
    $imagenumber = UBound ($aImageInfo, 1)
        If @error Then $imagenumber = _ArrayCreate("<Empty>")
    $x = 0
    Dim $nitem[$imagenumber]
    Do
    $nitem[$x] = GUICtrlCreateTreeViewItem ( "Image: #" & $x +1 & ": " & $aImageInfo[$x], $treeview )
    GUICtrlCreateTreeViewItem ( "Description: " & $aImageDesc [$x], $nitem[$x] )
    GUICtrlCreateTreeViewItem ( "File Count: " & $aImageFileCount [$x], $nitem[$x] )
   ;GUICtrlCreateTreeViewItem ( "Build Version: " & $aImageBuild [$x], $nitem[$x] ) 
    GUICtrlSetState($nitem[$x], $GUI_DEFBUTTON)
    $x = $x + 1
    Until $x = $imagenumber
EndFunc

Func DoApply()
    If StringInStr(GUICtrlRead(47, 1),'Image: #') > 0 Then
        Dim $arINum = StringSplit(GUICtrlRead(47, 1), '#')
        GUICtrlSetData($hApplyName, StringLeft($arINum[2],1))
    Else
        Msgbox(4096,"Apply", "You must select the image to apply." & @CRLF & "Example: Image: #1")
        Return
    EndIf
    $sCmd = '"' & @ScriptDir & '\imagex.exe"'
        
    If $gApplyVerify = 1 Then $sCmd = $sCmd & " /verify"
    $sCmd = $sCmd & ' /apply /scroll "' & GUICtrlRead($hApplySourceEdit) & '" "' & GUICtrlRead($hApplyName) & '" "' & GUICtrlRead($hApplyDestEdit) & '"'
    
    If GUICtrlRead($hApplyDiagCheck) = '1' Then
        $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW)
    Else
        $ret = ShowProgress($sCmd, 'Applying...')
    EndIf
    If $ret = '0' Then
        SplashTextOn ( 'ImageX Status', 'Image Successfully Applied!', 400, 50, -1, -1, 32, "Tahoma", 14, 500)
        Sleep (3000)
        SplashOff ()
    Else
        SplashTextOn ( 'ImageX Status', 'ImageX.exe ERROR : ' & $ret, 400, 50, -1, -1, 32, "Tahoma", 14, 500)
        Sleep (5000)
        SplashOff ()
    EndIf
    $Rebootstate = GUICtrlRead ($hReboot)
    If $Rebootstate = 1 Then
    _RunDOS("Start wpeutil reboot")
    EndIf
EndFunc

Func DoMapping()
    $gMapLetter = GUICtrlRead ( $hMapLetter )
    DriveMapDel($gMapLetter)
    $gMapShare = GUICtrlRead ( $hMapShareEdit );IniRead($sIni, "Map", "Share", "\\SERVER\SHARE")
    $VistaAccount = GUICtrlRead ( $hMapUserEdit )
    $VistaPwd = GUICtrlRead ( $hMapPasswordEdit )
;   Msgbox(0,"MAP",$gMapLetter & $gMapShare & $VistaAccount & $VistaPwd)
    $res = DriveMapAdd($gMapLetter, $gMapShare, 0, $VistaAccount, $VistaPwd)
    
    If $res Then
        SplashTextOn ( 'Mapping Drive...', 'Drive successfully mapped!', 250, 50, -1, -1, 32, "Tahoma", 14, 500)
        sleep (2000)
        SplashOff()
    Else
        MsgBox(16, "Drive Mapping", "Error mapping drive! Code: " & $avDriveMapAdd[@error])
    EndIf   
EndFunc

Func LoadSettings()
    $sIni = @ScriptDir & "\gimagex.ini"
    
    $gCaptureSource = IniRead($sIni, "CAPTURE", "Source", "")
    $gCaptureDestination = IniRead($sIni, "CAPTURE", "Destination", "MyWim.wim")
    $gCaptureCompression = IniRead($sIni, "CAPTURE", "Compression", "Maximum")
    $gCaptureFlags = IniRead($sIni, "CAPTURE", "Flags", "")
    $gCaptureConfig = IniRead($sIni, "CAPTURE", "Config", "")
    $gCaptureBoot = IniRead($sIni, "CAPTURE", "Boot", "1")
    $gCaptureCheck = IniRead($sIni, "CAPTURE", "Check", "1")
    $gCaptureName = IniRead($sIni, "CAPTURE", "Name", "My Build Name")
    $gCaptureDescription = IniRead($sIni, "CAPTURE", "Description", _Now())
    $gCaptureDiag = IniRead($sIni, "CAPTURE", "Diag", "0")
;
    $gApplySource = IniRead($sIni, "APPLY", "Source", "")
    $gApplyDestination = IniRead($sIni, "APPLY", "Destination", "MyWim.wim")
    $gApplyVerify = IniRead($sIni, "APPLY", "Verify", "0")
    $gApplyName = IniRead($sIni, "APPLY", "Name", "1")
    $gApplyDiag = IniRead($sIni, "APPLY", "Diag", "0")

    $gMapLetter = IniRead($sIni, "MAP", "Letter", "M:")
    $gMapShare = IniRead($sIni, "MAP", "Share", "\\Server\Share")
    $gMapUser = IniRead($sIni, "MAP", "User", "User")

EndFunc

Func SettingsToGUI()

   ; CAPTURE
    GUICtrlSetData($hCaptureSourceEdit, $gCaptureSource)
    GUICtrlSetData($hCaptureDestEdit, $gCaptureDestination)
    GUICtrlSetData($hCaptureCompression, $gCaptureCompression)
    GUICtrlSetData($hCaptureFlagsEdit, $gCaptureFlags)
    GUICtrlSetData($hCaptureConfigEdit, $gCaptureConfig)
    If $gCaptureBoot = 1 Then
        GUICtrlSetState($hCaptureBootCheck, $GUI_CHECKED)
    Else
        GUICtrlSetState($hCaptureBootCheck, $GUI_UNCHECKED)
    EndIf
    If $gCaptureCheck = 1 Then
        GUICtrlSetState($hCaptureCheckCheck, $GUI_CHECKED)
    Else
        GUICtrlSetState($hCaptureCheckCheck, $GUI_UNCHECKED)
    EndIf
    If $gCaptureDiag = 1 Then
        GUICtrlSetState($hCaptureDiagCheck, $GUI_CHECKED)
    Else
        GUICtrlSetState($hCaptureDiagCheck, $GUI_UNCHECKED)
    EndIf
    GUICtrlSetData($hCaptureNameEdit, $gCaptureName)
    GUICtrlSetData($hCaptureDescEdit, $gCaptureDescription)
    
   ; APPLY
    GUICtrlSetData($hApplySourceEdit, $gApplySource)
    GUICtrlSetData($hApplyDestEdit, $gApplyDestination)
    If $gApplyVerify = 1 Then
        GUICtrlSetState($hApplyVerifyCheck, $GUI_CHECKED)
    Else
        GUICtrlSetState($hApplyVerifyCheck, $GUI_UNCHECKED)
    EndIf
    If $gApplyDiag = 1 Then
        GUICtrlSetState($hApplyDiagCheck, $GUI_CHECKED)
    Else
        GUICtrlSetState($hApplyDiagCheck, $GUI_UNCHECKED)
    EndIf
    GUICtrlSetData($hApplyName, $gApplyName)

   ; MAP
    GUICtrlSetData($hMapLetter, $gMapLetter)
    GUICtrlSetData($hMapShareEdit, $gMapShare)
    GUICtrlSetData($hMapUserEdit, $gMapUser)
    GUICtrlSetData($hMapPasswordEdit, $gMapPassword)

EndFunc

Func ShowProgress($sCmd, $ImageType)
;Include rtconsole.exe for progress bar.
;
FileInstall("rtconsole.exe", @ScriptDir & "\rtconsole.exe")

;Msgbox(0,"RUN",'"' & @ScriptDir & '\rtconsole.exe" ' & $sCmd)
$foo = Run('"' & @ScriptDir & '\rtconsole.exe" ' & $sCmd,'','',2+4)
$line1 = '0'
ProgressOn('Imagex', 'ImageX', $line1)

While 1
    $line = StdoutRead($foo)
    if StringInStr($line, 'ImageX Tool for Windows') <> 0 then $line = 0
    if StringInStr($line, 'Progress: 100%') <> 0  then ExitLoop
    if StringInStr($line, 'Error') <> 0  then ExitLoop
    $line = StringStripWS($line, 7)
    if StringInStr($line, ',') <> 0 Then
;   $line2 = StringSplit($line, ',')
;   $line3 = StringRight($line2[2], StringLen($line2[2])-1)
    EndIf
    $line3 = StringSplit($line, @CRLF)
    $line1 = StringSplit($line, '%')
    $line = StringRight($line1[1], 2)
    If @error Then ExitLoop
    If $line <> "" Then
        ProgressSet($line, $line3[1], $ImageType)
    EndIf
Wend

ProgressOff()
FileDelete(@ScriptDir & "\rtconsole.exe")
EndFunc

Share this post


Link to post
Share on other sites
vbarbieri

I have two problems when I make click on browse opens an empty window when I make not ago click on format nothing

thanks

Share this post


Link to post
Share on other sites
Silverhawke

HI, great work, thanks.

Sorry my english, i´m Italian ;-)

Can you add a Tab where a WIN File was read wid the option /info to have a idea wath contain the WIM.

Can you ad two Tabs one for mount end another to unmount a wim file.

Thanke, wery thanks

Silverhawke <_<

Share this post


Link to post
Share on other sites
Valuater

This will not check for all required files...

Your code

;Check for ImageX required files
;
If FileExists(@ScriptDir & "\imagex.exe") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimfltr.dll") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimfltr.sys") Then;File Found
ElseIf FileExists(@ScriptDir & "\wimgapi.dll") Then;File Found
Else
    Msgbox(4096,"ImageXGUI", "You are missing one of the required files in the current folder: " & @ScriptDir & @CRLF & "ImageX will not function without these files!" & _
    @CRLF & @CRLF & "imagex.exe" & @CRLF & "wimfltr.dll" & @CRLF & "wimfltr.sys" & @CRLF & "wimgapi.dll")
EndIfoÝ÷ ÚØb³¥«­¢+Øí
¡¬½È%µ`ÉÅեɥ±Ì(ì)%¥±á¥ÍÑÌ¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈí¥µà¹áÅÕ½Ð줹¥±á¥ÍÑÌ¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíÝ¥µ±Ñȹ±°ÅÕ½Ð줹¥±á¥ÍÑÌ¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíÝ¥µ±ÑȹÍåÌÅÕ½Ð줹¥±á¥ÍÑÌ¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíÝ¥µÁ¤¹±°ÅÕ½Ðì¤Q¡¸(í¥±½Õ¹)±Í(5ͽà ÐÀäØ°ÅÕ½Ðí%µaU$ÅÕ½Ðì°ÅÕ½Ðíe½Ôɵ¥ÍÍ¥¹½¹½Ñ¡ÉÅեɥ±Ì¥¸Ñ¡ÕÉɹн±ÈèÅÕ½ÐìµÀìMÉ¥ÁѥȵÀì
I1µÀìÅÕ½Ðí%µ`Ý¥±°¹½Ðչѥ½¸Ý¥Ñ¡½ÕÐÑ¡Í¥±ÌÌÌìÅÕ½ÐìµÀì|(
I1µÀì
I1µÀìÅÕ½Ðí¥µà¹áÅÕ½ÐìµÀì
I1µÀìÅÕ½ÐíÝ¥µ±Ñȹ±°ÅÕ½ÐìµÀì
I1µÀìÅÕ½ÐíÝ¥µ±ÑȹÍåÌÅÕ½ÐìµÀì
I1µÀìÅÕ½ÐíÝ¥µÁ¤¹±°ÅÕ½Ðì¤(á¥Ð)¹%

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×