joshiieeii Posted November 15, 2006 Posted November 15, 2006 (edited) Imagex GUIIntended for use within WinPE 2.0Note: you have to have imagex.exe in the same folder.Update 4-9-07:Added Poll image function to display what images are available within a wim file.Added Automatic Reboot functionality.gimagex.ini[CAPTURE] Source=C: Destination=MyWim.wim Compression=Fast Flags=Enterprise Config= Boot=0 Check=1 Name=My Vista Build Name Description=My Vista Build Description [APPLY] Source=M:\Vista.wim Destination=C: Verify=0 Name=1 [MAP] Letter=M: Share=\\networkshare\folder User=domain.com\TestUsergimagex.exeexpandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <Array.au3> #include <Process.au3> #include <String.au3> #include <GuiTreeView.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 ; 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 ; ; 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("C:", $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 Vista Image", $CurX+85, $CurY, 300) $CurY = $CurY + 27 GUICtrlCreateLabel("Description", $CurX+20, $CurY+3) $hCaptureDescEdit = GUICtrlCreateInput("My Vista 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("/flags", $CurX+20, $CurY+3) $hCaptureFlagsEdit = GUICtrlCreateInput("Ultimate", $CurX+85, $CurY, 300) $CurY = $CurY + 27 $hCaptureBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX+20, $CurY) $hCaptureCheckCheck = GUICtrlCreateCheckbox("/check", $CurX+190, $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("C:", $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+100, 130,15) $hApplyVerifyCheck = GUICtrlCreateCheckbox("/verify", $CurX+150, $CurY+100, 100, 15 ) GUICtrlSetState ($hReboot, $GUI_CHECKED) $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 = $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", "C:") If StringRight($sDir, 1) = "\" Then $sDir = StringTrimRight($sDir, 1) Return $sDir EndFunc Func BrowseForWimToSave() $sFile = FileSaveDialog( "Select destination file", "C:\", "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", "C:\", "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 & ' /flags "' & $gCaptureFlags & '"' $sCmd = $sCmd & ' /capture "' & $gCaptureSource & '" "' & $gCaptureDestination & '"' $sCmd = $sCmd & ' "' & $gCaptureName & '" "' & $gCaptureDescription & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn ( "Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) sleep (3000) SplashOff () EndFunc Func PollImage () Dim $nitem, $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>" ) $aImageDesc = _StringBetween ( $imageinfo, "<Description>", "</Description>" ) $aImageFileCount = _StringBetween ( $imageinfo, "<Filecount>", "</Filecount>" ) $aImageBuild = _StringBetween ( $imageinfo, "<Build>", "</Build>" ) $imagenumber = UBound ($aImageInfo, 1) $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() $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gApplyVerify = 1 Then $sCmd = $sCmd & " /verify" $sCmd = $sCmd & ' /apply "' & $gApplySource & '" "' & $gApplyName & '" "' & $gApplyDestination & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn ( "Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) sleep (3000) SplashOff () $Rebootstate = GUICtrlRead ($hReboot) If $Rebootstate = 1 Then _RunDOS("Start wpeutil reboot") EndIf EndFunc Func DoMapping() $gMapLetter = IniRead($sIni, "MAP", "Letter", "V:") DriveMapDel($gMapLetter) $gMapShare = IniRead($sIni, "Map", "Share", "") $VistaAccount = GUICtrlRead ( $hMapUserEdit ) $VistaPwd = GUICtrlRead ( $hMapPasswordEdit ) $res = DriveMapAdd($gMapLetter, $gMapShare, 0, $VistaAccount, $VistaPwd) If $res Then ControlSetText("Mapping Drive", "", "Static1", "Drive successfully mapped!" ) sleep (2000) ;MsgBox(64, "Drive Mapping", "Drive successfully mapped!") Else SplashOff() MsgBox(16, "Drive Mapping", "Error mapping drive! Code: " & $avDriveMapAdd[@error]) EndIf EndFunc Func LoadSettings() $sIni = @ScriptDir & "\gimagex.ini" $gCaptureSource = IniRead($sIni, "CAPTURE", "Source", "C:") $gCaptureDestination = IniRead($sIni, "CAPTURE", "Destination", "MyWim.wim") $gCaptureCompression = IniRead($sIni, "CAPTURE", "Compression", "Maximum") $gCaptureFlags = IniRead($sIni, "CAPTURE", "Flags", "Ultimate") $gCaptureConfig = IniRead($sIni, "CAPTURE", "Config", "") $gCaptureBoot = IniRead($sIni, "CAPTURE", "Boot", "0") $gCaptureCheck = IniRead($sIni, "CAPTURE", "Check", "1") $gCaptureName = IniRead($sIni, "CAPTURE", "Name", "My Vista Build Name") $gCaptureDescription = IniRead($sIni, "CAPTURE", "Description", "My Vista Build Description") $gApplySource = IniRead($sIni, "APPLY", "Source", "C:") $gApplyDestination = IniRead($sIni, "APPLY", "Destination", "MyWim.wim") $gApplyVerify = IniRead($sIni, "APPLY", "Verify", "0") $gApplyName = IniRead($sIni, "APPLY", "Name", "My Vista Build Name") $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 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 GUICtrlSetData($hApplyName, $gApplyName) ; MAP GUICtrlSetData($hMapLetter, $gMapLetter) GUICtrlSetData($hMapShareEdit, $gMapShare) GUICtrlSetData($hMapUserEdit, $gMapUser) GUICtrlSetData($hMapPasswordEdit, $gMapPassword) EndFunc Edited April 9, 2007 by joshiieeii Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed
urie Posted March 12, 2007 Posted March 12, 2007 Hi guys, Jon had posted some script HERE. I thought I would add on to it a little. Goals:Make the Image Selection process a little neater (under Apply tab)Clear password and username after successfully mapping drive (under Drive map tab)Note: you have to have imagex.exe in the same folder. I am hoping to get some suggestions on how to improve the PollImage function, it's a bit sloppy, but I wanted to share what I have thus far with everyone. This is what I have thus far (it's not as neat as Jon's code): expandcollapse popup; ; Constants from GuiConstant.au3 (or just include GuiConstants.au3 instead) #include <Constants.au3> #Include<Array.au3> Global Const $CBS_DROPDOWNLIST = 0x0003 Global Const $ES_PASSWORD = 32 Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_CHECKED = 1 Global Const $GUI_INDETERMINATE = 2 Global Const $GUI_UNCHECKED = 4 Dim $sArrayString, $imageSelection ; ; Global Settings ; 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 $gMapLetter Dim $gMapUser Dim $gMapPassword Dim $gMapShare ; ; Create the main GUI ; GUICreate("GImageX - ImageX GUI Wrapper", 640, 380, -1, -1 ) $hTab = GUICtrlCreateTab(10, 10, 620, 355) $BaseX = 20 $BaseY = 35 $Domain = @LogonDomain ; ; 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($domain, $CurX+20, $CurY+3) $hMapUserEdit = GUICtrlCreateInput("%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("C:", $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 Vista Image", $CurX+85, $CurY, 300) $CurY = $CurY + 27 GUICtrlCreateLabel("Description", $CurX+20, $CurY+3) $hCaptureDescEdit = GUICtrlCreateInput("My Vista 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("/flags", $CurX+20, $CurY+3) $hCaptureFlagsEdit = GUICtrlCreateInput("Ultimate", $CurX+85, $CurY, 300) $CurY = $CurY + 27 $hCaptureBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX+20, $CurY) $hCaptureCheckCheck = GUICtrlCreateCheckbox("/check", $CurX+190, $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 ;~ $hApplyName = GUICtrlCreateInput("1", $CurX+85, $CurY, 300) $hApplyNameBrowse= GUICtrlCreateButton("2. Select Image", $CurX+15, $CurY+3) $CurY = $CurY + 27 GUICtrlCreateLabel("Destination", $CurX+20, $CurY+103) $hApplyDestEdit = GUICtrlCreateInput("C:", $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 $hApplyVerifyCheck = GUICtrlCreateCheckbox("/verify", $CurX+20, $CurY+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 GUIToSettings() SaveSettings() 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 = $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", "C:") If StringRight($sDir, 1) = "\" Then $sDir = StringTrimRight($sDir, 1) Return $sDir EndFunc Func BrowseForWimToSave() $sFile = FileSaveDialog( "Select destination file", "C:\", "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", "C:\", "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() GUIToSettings() SaveSettings() $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 & ' /flags "' & $gCaptureFlags & '"' $sCmd = $sCmd & ' /capture "' & $gCaptureSource & '" "' & $gCaptureDestination & '"' $sCmd = $sCmd & ' "' & $gCaptureName & '" "' & $gCaptureDescription & '"' ;MsgBox(0, "Debug", $sCmd) ;$ret = RunWait('imagex.exe /compress fast /capture "c:\drv\nvid" test.wim "test"', @WorkingDir, @SW_SHOW) ;$foo = RunWait('imagex.exe /compress fast /scroll /capture "c:\drv\nvid" test.wim "test"', @WorkingDir, @SW_SHOW, $STDOUT_CHILD) $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) MsgBox(0, "ImageX.exe", "Imagex.exe returned with code = " & $ret) EndFunc Func PollImage () $file = @ScriptDir & '\imagex.ini' $sCmd = '"' & @ScriptDir & '\imagex.exe"' $edit = GUICtrlRead ($hApplySourceEdit) $sCmd = $sCmd & ' /info ' & $edit $foo = Run(@ComSpec & " /c " & $sCmd, @WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $avArray = _ArrayCreate ("test") While 1 $line = StdoutRead($foo) If @error Then ExitLoop _ArrayAdd ( $avArray, $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend _ArrayDisplay ($avArray, "array results") Dim $sArrayString = _ArrayToString ($avArray, ";") $image_count = StringInStr ( $sArrayString, "Image Count:", 0) $image_namein = StringInStr ( $sArrayString, "<NAME>", 0) $image_nameout = StringInStr ( $sArrayString, "</NAME>", 0) $image_nameCount = $image_nameout - $image_namein $test = StringMid ( $sArrayString, $image_count, 15) $imagename1 = StringMid ( $sArrayString, $image_namein+6, $image_nameCount-6) ;MsgBox (0, "Results:", $imagename1) Dim $imageSelection = GUICtrlCreateCheckbox ( $imagename1, $CurX+15, $CurY-50) ;pulls description from wim image $image_descin = StringInStr ( $sArrayString, "<DESCRIPTION>", 0) $image_descout = StringInStr ( $sArrayString, "</DESCRIPTION>", 0) $image_descCount = $image_descout - $image_descin $imageDescription = StringMid ( $sArrayString, $image_descin+13, $image_descCount-13) GUICtrlCreateLabel ( "Description: " & $imageDescription, $CurX+15, $CurY-30, 200, 15) EndFunc Func DoApply() GUIToSettings() SaveSettings() $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $imageSelection = 1 then $gApplySource = 1 If $gApplyVerify = 1 Then $sCmd = $sCmd & " /verify" $sCmd = $sCmd & ' /apply "' & $gApplySource & '" "' & $gApplyName & '" "' & $gApplyDestination & '"' ;MsgBox(0, "Debug", $sCmd) ;$ret = RunWait('imagex.exe /compress fast /capture "c:\drv\nvid" test.wim "test"', @WorkingDir, @SW_SHOW) ;$foo = RunWait('imagex.exe /compress fast /scroll /capture "c:\drv\nvid" test.wim "test"', @WorkingDir, @SW_SHOW, $STDOUT_CHILD) $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) MsgBox(0, "ImageX.exe", "Imagex.exe returned with code = " & $ret) EndFunc Func DoMapping() GUIToSettings() SaveSettings() DriveMapDel($gMapLetter) If $gMapUser Then $res = DriveMapAdd($gMapLetter, $gMapShare, 0, $domain & $gMapUser, $gMapPassword) Else $res = DriveMapAdd($gMapLetter, $gMapShare, 0) EndIf If $res Then MsgBox(64, "Drive Mapping", "Drive successfully mapped!") Else MsgBox(16, "Drive Mapping", "Error mapping drive!") EndIf EndFunc Func LoadSettings() $sIni = @ScriptDir & "\gimagex.ini" $gCaptureSource = IniRead($sIni, "CAPTURE", "Source", "C:") $gCaptureDestination = IniRead($sIni, "CAPTURE", "Destination", "MyWim.wim") $gCaptureCompression = IniRead($sIni, "CAPTURE", "Compression", "Maximum") $gCaptureFlags = IniRead($sIni, "CAPTURE", "Flags", "Ultimate") $gCaptureConfig = IniRead($sIni, "CAPTURE", "Config", "") $gCaptureBoot = IniRead($sIni, "CAPTURE", "Boot", "0") $gCaptureCheck = IniRead($sIni, "CAPTURE", "Check", "1") $gCaptureName = IniRead($sIni, "CAPTURE", "Name", "My Vista Build Name") $gCaptureDescription = IniRead($sIni, "CAPTURE", "Description", "My Vista Build Description") $gApplySource = IniRead($sIni, "APPLY", "Source", "C:") $gApplyDestination = IniRead($sIni, "APPLY", "Destination", "MyWim.wim") $gApplyVerify = IniRead($sIni, "APPLY", "Verify", "0") $gApplyName = IniRead($sIni, "APPLY", "Name", "My Vista Build Name") $gMapLetter = IniRead($sIni, "MAP", "Letter", "M:") $gMapShare = IniRead($sIni, "MAP", "Share", "\\Server\Share") $gMapUser = IniRead($sIni, "MAP", "User", "User") EndFunc Func SaveSettings() $sIni = @ScriptDir & "\gimagex.ini" IniWrite($sIni, "CAPTURE", "Source", $gCaptureSource) IniWrite($sIni, "CAPTURE", "Destination", $gCaptureDestination) IniWrite($sIni, "CAPTURE", "Compression", $gCaptureCompression) IniWrite($sIni, "CAPTURE", "Flags", $gCaptureFlags) IniWrite($sIni, "CAPTURE", "Config", $gCaptureConfig) IniWrite($sIni, "CAPTURE", "Boot", $gCaptureBoot) IniWrite($sIni, "CAPTURE", "Check", $gCaptureCheck) IniWrite($sIni, "CAPTURE", "Name", $gCaptureName) IniWrite($sIni, "CAPTURE", "Description", $gCaptureDescription) IniWrite($sIni, "APPLY", "Source", $gApplySource) IniWrite($sIni, "APPLY", "Destination", $gApplyDestination) IniWrite($sIni, "APPLY", "Verify", $gApplyVerify) IniWrite($sIni, "APPLY", "Name", $gApplyName) IniWrite($sIni, "MAP", "Letter", $gMapLetter) IniWrite($sIni, "MAP", "Share", $gMapShare) IniWrite($sIni, "MAP", "User", $gMapUser) 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 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 ;~ GUICtrlSetData($hApplyName, $gApplyName) ; MAP GUICtrlSetData($hMapLetter, $gMapLetter) GUICtrlSetData($hMapShareEdit, $gMapShare) GUICtrlSetData($domain & $hMapUserEdit, $gMapUser) GUICtrlSetData($hMapPasswordEdit, $gMapPassword) EndFunc Func GUIToSettings() ; CAPTURE $gCaptureSource = GUICtrlRead($hCaptureSourceEdit) $gCaptureDestination = GUICtrlRead($hCaptureDestEdit) $gCaptureCompression = GUICtrlRead($hCaptureCompression) $gCaptureFlags = GUICtrlRead($hCaptureFlagsEdit) $gCaptureConfig = GUICtrlRead($hCaptureConfigEdit) If GUICtrlRead($hCaptureBootCheck) = $GUI_CHECKED Then $gCaptureBoot = 1 Else $gCaptureBoot = 0 EndIf If GUICtrlRead($hCaptureCheckCheck) = $GUI_CHECKED Then $gCaptureCheck = 1 Else $gCaptureCheck = 0 EndIf $gCaptureName = GUICtrlRead($hCaptureNameEdit) $gCaptureDescription = GUICtrlRead($hCaptureDescEdit) ; APPLY $gApplySource = GUICtrlRead($hApplySourceEdit) $gApplyDestination = GUICtrlRead($hApplyDestEdit) If GUICtrlRead($hApplyVerifyCheck) = $GUI_CHECKED Then $gApplyVerify = 1 Else $gApplyVerify = 0 EndIf ;~ $gApplyName = GUICtrlRead($hApplyName) ; MAP $gMapLetter = GUICtrlRead($hMapLetter) $gMapShare = GUICtrlRead($hMapShareEdit) $gMapUser= GUICtrlRead($domain & $hMapUserEdit) $gMapPassword= GUICtrlRead($hMapPasswordEdit) EndFunc joshiieeii, excellent script would it be possible to edit the script so it can mount and unmount WIM images on local partitions or folders Thanks
mdwerne Posted April 12, 2007 Posted April 12, 2007 @joshiieeiiI really like the changes you've made to Jons code looking forward to seeing it progress. It's probably something I'm doing wrong, but when I try and map a drive, I get the following error."Error mapping drive! Code: Unknown Error"With Jon's orginal code, I do not get this error.Thanks and keep up the effort!-Mike
mdwerne Posted April 12, 2007 Posted April 12, 2007 Since I'm a newbie and can't seem to figure out how to edit my own post :"> ...Maybe my problem is I'm trying to map in WinXP Pro and PE 1.2 - do I need PE 2.0 to use this version or is it just a suggestion?Thanks again,-Mike
geo411m Posted April 29, 2007 Posted April 29, 2007 i really like your program but im having problems with it. i can capture an image fine but i cannot deploy (error 2). i have both gimagex.exe and gimagex.ini in the windows folder where imagex.exe is. i think whatever info is in gimagex.ini is what the program uses even if you change options in the gui. if im doing something wrong please let me know. also would it be possible to edit the script so it can mount and unmount WIM images on local partitions or folders. again great program.
Zedna Posted April 29, 2007 Posted April 29, 2007 (edited) Very nice StdoutRead & _StringBetween & GUICtrlCreateTreeViewItem example code.Func PollImage () Dim $nitem, $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>" ) $aImageDesc = _StringBetween ( $imageinfo, "<Description>", "</Description>" ) $aImageFileCount = _StringBetween ( $imageinfo, "<Filecount>", "</Filecount>" ) $aImageBuild = _StringBetween ( $imageinfo, "<Build>", "</Build>" ) $imagenumber = UBound ($aImageInfo, 1) $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 Edited April 29, 2007 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search
geo411m Posted April 29, 2007 Posted April 29, 2007 i just tried the original code by Jon and all works without problem.
jagger1616 Posted May 3, 2007 Posted May 3, 2007 Has any of you been able to use ImageX to apply a spanned image. It's a rather ridiculous problem if you ask me because imageX allows you to split the files but not apply them while they are split. Any feedback or experience is much appreciated.
original21 Posted June 6, 2007 Posted June 6, 2007 Hello. I am trying to apply a image using this tool but is not working. I can map a network drive and capture a image, but when i am trying to apply a image from the network location to the C: is not working. returns error=2. Any ideas why this happens? Thanks Please allow me to introduce myself I'm a man of wealth and taste I've been around for a long, long year Stole many a man's soul and faith
drchandra Posted June 26, 2007 Posted June 26, 2007 Hello people, i'm really impressed with this tool i've extended it to include Mount- Unmount, Append, Export, Delete, Info and Split building it up the original script by joshiieeii and the progress bar, DiskPartioner and rtlconsol by ImageXGUI .... i also put a function to save the settings automatically and i'm planning to include a way to make exclusion list ...here is the script :expandcollapse popup#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 ;Capture Dim $gCaptureSource Dim $gCaptureDestination Dim $gCaptureCompression Dim $gCaptureFlags Dim $gCaptureConfig Dim $gCaptureBoot Dim $gCaptureCheck Dim $gCaptureName Dim $gCaptureDescription Dim $gCaptureDiag ;Export Dim $gExportSource Dim $gExportDestination Dim $gExportCompression Dim $gExportFlags Dim $gExportConfig Dim $gExportBoot Dim $gExportCheck Dim $gExportName Dim $gExportDescription Dim $gExportNumber ;Info Dim $gInfoSource Dim $gInfoFlags Dim $gInfoBoot Dim $gInfoCheck Dim $gInfoName Dim $gInfoDescription Dim $gInfoNumber ;Split Dim $gSplitSource Dim $gSplitFlags Dim $gSplitBoot Dim $gSplitCheck Dim $gSplitName Dim $gSplitDescription Dim $gSplitNumber ;Append Dim $gAppendSource Dim $gAppendDestination Dim $gAppendCompression Dim $gAppendFlags Dim $gAppendConfig Dim $gAppendBoot Dim $gAppendCheck Dim $gAppendName Dim $gAppendDescription ;Delete Dim $gDeleteSource Dim $gDeleteDestination Dim $gDeleteName Dim $gDelCheck ;Mount Dim $gMountSource Dim $gMountDestination Dim $gMountName Dim $gRWCheck ;Apply 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", 679, 380, -1, -1) $hTab = GUICtrlCreateTab(10, 10, 660, 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) ; Mount Tab ; $hTab_2 = GUICtrlCreateTabItem(" Mount - Unmount ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 205) $CurY = $CurY + 18 GUICtrlCreateLabel("1. Mount image", $CurX + 20, $CurY + 3) $hMountSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 100, $CurY, 300) $hMountSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 410, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Input Image Number", $CurX + 15, $CurY + 30, 70, 30) $hMountName = GUICtrlCreateInput("1", $CurX + 85, $CurY + 30, 40, 20) $hMountNameBrowse = GUICtrlCreateButton("2. Poll Image Number", $CurX + 15, $CurY + 1) $treeviewm = GUICtrlCreateTreeView(150, 90, 450, 120, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $CurY = $CurY + 27 GUICtrlCreateLabel("Select folder", $CurX + 20, $CurY + 103) $hMountDestEdit = GUICtrlCreateInput("C:", $CurX + 100, $CurY + 100, 300) $hMountDestBrowse = GUICtrlCreateButton("Browse", $CurX + 410, $CurY + 98) ; Options Group $CurY = $CurY + 40 GUICtrlCreateGroup("Options", $CurX + 10, $CurY + 100, 580, 50) $CurY = $CurY + 18 $hRWCheck = GUICtrlCreateCheckbox("Read Write Access", $CurX + 20, $CurY + 100, 130, 15) $hMountButtonGo = GUICtrlCreateButton("&Mount!", $BaseX + 390, $BaseY + 290, 100) $hUnmountButtonGo = GUICtrlCreateButton("&Unmount!", $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) ; Append Tab ; $hTab_1 = GUICtrlCreateTabItem(" Append ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 155) $CurY = $CurY + 18 GUICtrlCreateLabel("Destination Image", $CurX + 20, $CurY + 3) $hAppendSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hAppendSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Select volume to image", $CurX + 20, $CurY + 3) $hAppendDestEdit = GUICtrlCreateInput("my computer", $CurX + 140, $CurY, 300) $hAppendDestBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Image name", $CurX + 20, $CurY + 3) $hAppendNameEdit = GUICtrlCreateInput("My Vista Image", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 GUICtrlCreateLabel("Description", $CurX + 20, $CurY + 3) $hAppendDescEdit = GUICtrlCreateInput("My Vista Image Description", $CurX + 140, $CurY, 300) ; Options Group $CurY = $CurY + 65 GUICtrlCreateGroup("Options", $CurX + 10, $CurY, 580, 100) $CurY = $CurY + 18 GUICtrlCreateLabel("/config", $CurX + 20, $CurY + 3) $hAppendConfigEdit = GUICtrlCreateInput("", $CurX + 140, $CurY, 300) $hAppendConfigBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("/flags", $CurX + 20, $CurY + 3) $hAppendFlagsEdit = GUICtrlCreateInput("", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 $hAppendBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX + 20, $CurY) $hAppendCheckCheck = GUICtrlCreateCheckbox("/check", $CurX + 190, $CurY) $hAppendButtonGo = GUICtrlCreateButton("&Append!", $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) ; Export Tab ; $hTab_1 = GUICtrlCreateTabItem(" Export ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 155) $CurY = $CurY + 18 GUICtrlCreateLabel("Source image", $CurX + 20, $CurY + 3) $hExportSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hExportSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Source image number", $CurX + 20, $CurY + 3) $hExportNumber = GUICtrlCreateInput("1", $CurX + 140, $CurY, 40, 20) $CurY = $CurY + 27 GUICtrlCreateLabel("Exported image", $CurX + 20, $CurY + 3) $hExportDestEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hExportDestBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Exported image name", $CurX + 20, $CurY + 3) $hExportNameEdit = GUICtrlCreateInput("My Vista Image", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 GUICtrlCreateLabel("Compression", $CurX + 20, $CurY + 3) $hExportCompression = GUICtrlCreateCombo("Maximum", $CurX + 85, $CurY, 100, 500, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Fast") ; Options Group $CurY = $CurY + 40 GUICtrlCreateGroup("Options", $CurX + 10, $CurY, 580, 100) $CurY = $CurY + 18 $CurY = $CurY + 27 GUICtrlCreateLabel("/flags", $CurX + 20, $CurY + 3) $hExportFlagsEdit = GUICtrlCreateInput("", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 $hExportBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX + 20, $CurY) $hExportCheckCheck = GUICtrlCreateCheckbox("/check", $CurX + 190, $CurY) $hExportButtonGo = GUICtrlCreateButton("&Export!", $BaseX + 500, $BaseY + 290, 100) ; Delete Tab ; $hTab_2 = GUICtrlCreateTabItem(" Delete ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 205) $CurY = $CurY + 18 GUICtrlCreateLabel("1. Select image", $CurX + 20, $CurY + 3) $hDeleteSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 100, $CurY, 300) $hDeleteSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 410, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Input Image Number", $CurX + 15, $CurY + 30, 70, 30) $hDeleteName = GUICtrlCreateInput("1", $CurX + 85, $CurY + 30, 40, 20) $hDeleteNameBrowse = GUICtrlCreateButton("2. Poll Image Number", $CurX + 15, $CurY + 1) $treeviewd = GUICtrlCreateTreeView(150, 90, 450, 120, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $CurY = $CurY + 27 ; Options Group $CurY = $CurY + 40 GUICtrlCreateGroup("Options", $CurX + 10, $CurY + 100, 580, 50) $CurY = $CurY + 18 $hDelCheck = GUICtrlCreateCheckbox("/Check", $CurX + 20, $CurY + 100, 130, 15) $hDeleteButtonGo = GUICtrlCreateButton("&Delete!", $BaseX + 500, $BaseY + 290, 100) ; Split Tab ; $hTab_1 = GUICtrlCreateTabItem(" Split ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 155) $CurY = $CurY + 18 GUICtrlCreateLabel("Source image", $CurX + 20, $CurY + 3) $hSplitSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hSplitSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Exported image", $CurX + 20, $CurY + 3) $hSplitDestEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hSplitDestBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Split image size in MB", $CurX + 20, $CurY + 3) $hSplitNumber = GUICtrlCreateInput("650", $CurX + 140, $CurY, 40, 20) ; Options Group $CurY = $CurY + 90 GUICtrlCreateGroup("Options", $CurX + 10, $CurY, 580, 100) $CurY = $CurY + 18 $CurY = $CurY + 27 GUICtrlCreateLabel("/flags", $CurX + 20, $CurY + 3) $hSplitFlagsEdit = GUICtrlCreateInput("", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 $hSplitCheckCheck = GUICtrlCreateCheckbox("/check", $CurX + 190, $CurY) $hSplitButtonGo = GUICtrlCreateButton("&Split!", $BaseX + 500, $BaseY + 290, 100) ; Info Tab ; $hTab_1 = GUICtrlCreateTabItem(" Info ") $CurX = $BaseX $CurY = $BaseY ; File Group $CurY = $CurY + 10 GUICtrlCreateGroup("WIM Image", $CurX + 10, $CurY, 580, 155) $CurY = $CurY + 18 GUICtrlCreateLabel("Source image", $CurX + 20, $CurY + 3) $hInfoSourceEdit = GUICtrlCreateInput("MyWim.wim", $CurX + 140, $CurY, 300) $hInfoSourceBrowse = GUICtrlCreateButton("Browse", $CurX + 450, $CurY - 2) $CurY = $CurY + 27 GUICtrlCreateLabel("Source image number", $CurX + 20, $CurY + 3) $hInfoNumber = GUICtrlCreateInput("1", $CurX + 140, $CurY, 40, 20) $CurY = $CurY + 27 GUICtrlCreateLabel("New image name", $CurX + 20, $CurY + 3) $hInfoNewName = GUICtrlCreateInput("My Vista Image", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 GUICtrlCreateLabel("New image description", $CurX + 20, $CurY + 3) $hInfoNewDesc = GUICtrlCreateInput("My Vista Image", $CurX + 140, $CurY, 300) ; Options Group $CurY = $CurY + 65 GUICtrlCreateGroup("Options", $CurX + 10, $CurY, 580, 100) $CurY = $CurY + 18 $CurY = $CurY + 27 GUICtrlCreateLabel("/flags", $CurX + 20, $CurY + 3) $hInfoFlagsEdit = GUICtrlCreateInput("", $CurX + 140, $CurY, 300) $CurY = $CurY + 27 $hInfoBootCheck = GUICtrlCreateCheckbox("/boot (WinPE Images Only) ", $CurX + 20, $CurY) $hInfoCheckCheck = GUICtrlCreateCheckbox("/check", $CurX + 190, $CurY) $hInfoButtonGo = GUICtrlCreateButton("&Info!", $BaseX + 500, $BaseY + 290, 100) ; Credits Tab ; $hTab_1 = GUICtrlCreateTabItem(" Credits ") GUICtrlCreateLabel("Original Script by joshiieeii...", $CurX + 20, $CurY + 3) $CurY = $CurY + 27 GUICtrlCreateLabel("DiskPartitoner and progress bar plus other functionalities by ImageXGUI...", $CurX + 20, $CurY + 3) $CurY = $CurY + 27 GUICtrlCreateLabel("Mount/Unmount, Append, Export, Delete, Split, Info and automatically saving settings by Hosam M. Ahmed... ", $CurX + 20, $CurY + 3) ; ; 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 SaveSettings() 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) ; Info Messages Case $msg = $hInfoButtonGo SaveSettings() DoInfo() Case $msg = $hInfoSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hInfoSourceEdit, $sDir) ; Split Messages Case $msg = $hSplitButtonGo SaveSettings() DoSplit() Case $msg = $hSplitSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hSplitSourceEdit, $sDir) Case $msg = $hSplitDestBrowse $sFile = BrowseForWimToSave() If $sFile Then GUICtrlSetData($hSplitDestEdit, $sFile) ; Export Messages Case $msg = $hExportButtonGo SaveSettings() DoExport() Case $msg = $hExportSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hExportSourceEdit, $sDir) Case $msg = $hExportDestBrowse $sFile = BrowseForWimToSave() If $sFile Then GUICtrlSetData($hExportDestEdit, $sFile) ; Append Messages Case $msg = $hAppendButtonGo SaveSettings() DoAppend() Case $msg = $hAppendSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hAppendSourceEdit, $sDir) Case $msg = $hAppendDestBrowse $sFile = BrowseForDirectory() If $sFile Then GUICtrlSetData($hAppendDestEdit, $sFile) Case $msg = $hAppendConfigBrowse $sFile = BrowseForConfig() If $sFile Then GUICtrlSetData($hAppendConfigEdit, $sFile) ; Delete Messages Case $msg = $hDeleteNameBrowse PollImageDelete() Case $msg = $hDeleteButtonGo SaveSettings() DoDelete() Case $msg = $hDeleteSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hDeleteSourceEdit, $sDir) ; Mount Messages Case $msg = $hMountNameBrowse PollImageMount() Case $msg = $hMountButtonGo SaveSettings() DoMount() Case $msg = $hUnmountButtonGo DoUnmount() Case $msg = $hMountSourceBrowse $sDir = BrowseForWimToLoad() If $sDir Then GUICtrlSetData($hMountSourceEdit, $sDir) Case $msg = $hMountDestBrowse $sFile = BrowseForDirectory() If $sFile Then GUICtrlSetData($hMountDestEdit, $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 SaveSettings() 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 SaveSettings() 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 ;==>BrowseForDirectory 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 ;==>BrowseForWimToSave Func BrowseForWimToLoad() $sFile = FileOpenDialog("Select source file", "", "WIM Files (*.wim)", 3) If @error Then Return "" Return $sFile EndFunc ;==>BrowseForWimToLoad Func BrowseForConfig() $sFile = FileOpenDialog("Select config file", @ScriptDir, "INI files (*.ini)", 1) If @error Or StringRight($sFile, 4) <> ".ini" Then Return "" Return $sFile EndFunc ;==>BrowseForConfig Func DoCapture() $gCaptureSource = GUICtrlRead($hCaptureSourceEdit) $gCaptureDestination = GUICtrlRead($hCaptureDestEdit) $gCaptureCompression = GUICtrlRead($hCaptureCompression) $gCaptureFlags = GUICtrlRead($hCaptureFlagsEdit) $gCaptureConfig = GUICtrlRead($hCaptureConfigEdit) $gCaptureBoot = GUICtrlRead($hCaptureBootCheck) $gCaptureCheck = GUICtrlRead($hCaptureCheckCheck) $gCaptureName = GUICtrlRead($hCaptureNameEdit) $gCaptureDescription = GUICtrlRead($hCaptureDescEdit) $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 ;==>DoCapture Func DoExport() $gExportSource = GUICtrlRead($hExportSourceEdit) $gExportDestination = GUICtrlRead($hExportDestEdit) $gExportCompression = GUICtrlRead($hExportCompression) $gExportFlags = GUICtrlRead($hExportFlagsEdit) $gExportBoot = GUICtrlRead($hExportBootCheck) $gExportCheck = GUICtrlRead($hExportCheckCheck) $gExportName = GUICtrlRead($hExportNameEdit) $gExportNumber = GUICtrlRead($hExportNumber) $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gExportCompression = "fast" Then $sCmd = $sCmd & " /compress fast" Else $sCmd = $sCmd & " /compress maximum" EndIf If $gExportCheck = 1 Then $sCmd = $sCmd & " /check" If $gExportBoot = 1 Then $sCmd = $sCmd & " /boot" If $gExportFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gExportFlags & '"' $sCmd = $sCmd & ' /Export "' & $gExportSource & '" "' & $gExportNumber & '" "' & $gExportDestination & '" "' & $gExportName & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoExport Func DoSplit() $gSplitSource = GUICtrlRead($hSplitSourceEdit) $gSplitDestination = GUICtrlRead($hSplitDestEdit) $gSplitFlags = GUICtrlRead($hSplitFlagsEdit) $gSplitCheck = GUICtrlRead($hSplitCheckCheck) $gSplitNumber = GUICtrlRead($hSplitNumber) $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gSplitCheck = 1 Then $sCmd = $sCmd & " /check" If $gSplitFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gSplitFlags & '"' $sCmd = $sCmd & ' /Split "' & $gSplitSource & '" "' & $gSplitDestination & '" "' & $gSplitNumber & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoSplit Func DoInfo() $gInfoSource = GUICtrlRead($hInfoSourceEdit) $gInfoDescription = GUICtrlRead($hInfoNewDesc) $gInfoFlags = GUICtrlRead($hInfoFlagsEdit) $gInfoBoot = GUICtrlRead($hInfoBootCheck) $gInfoCheck = GUICtrlRead($hInfoCheckCheck) $gInfoName = GUICtrlRead($hInfoNewName) $gInfoNumber = GUICtrlRead($hInfoNumber) $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gInfoCheck = 1 Then $sCmd = $sCmd & " /check" If $gInfoBoot = 1 Then $sCmd = $sCmd & " /boot" If $gInfoFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gInfoFlags & '"' $sCmd = $sCmd & ' /Info "' & $gInfoSource & '" "' & $gInfoNumber & '" "' & $gInfoName & '" "' & $gInfoDescription & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoInfo Func DoAppend() $gAppendSource = GUICtrlRead($hAppendSourceEdit) $gAppendDestination = GUICtrlRead($hAppendDestEdit) $gAppendFlags = GUICtrlRead($hAppendFlagsEdit) $gAppendConfig = GUICtrlRead($hAppendConfigEdit) $gAppendBoot = GUICtrlRead($hAppendBootCheck) $gAppendCheck = GUICtrlRead($hAppendCheckCheck) $gAppendName = GUICtrlRead($hAppendNameEdit) $gAppendDescription = GUICtrlRead($hAppendDescEdit) $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gAppendConfig <> "" Then $sCmd = $sCmd & ' /config "' & $gAppendConfig & '"' If $gAppendCheck = 1 Then $sCmd = $sCmd & " /check" If $gAppendBoot = 1 Then $sCmd = $sCmd & " /boot" If $gAppendFlags <> "" Then $sCmd = $sCmd & ' /flags "' & $gAppendFlags & '"' $sCmd = $sCmd & ' /Append "' & $gAppendDestination & '" "' & $gAppendSource & '"' $sCmd = $sCmd & ' "' & $gAppendName & '" "' & $gAppendDescription & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoAppend Func DoDelete() $gDeleteSource = GUICtrlRead($hDeleteSourceEdit) $gDeleteName = GUICtrlRead($hDeleteName) $gDelCheck = GUICtrlRead($hDelCheck) If StringInStr(GUICtrlRead(122, 1), 'Image: #') > 0 Then Dim $arINum = StringSplit(GUICtrlRead(122, 1), '#') GUICtrlSetData($hDeleteName, 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 $gDelCheck = 1 Then $sCmd = $sCmd & " /check" $sCmd = $sCmd & " /Delete" $sCmd = $sCmd & '" "' & $gDeleteSource & '" "' & $gDeleteName & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoDelete Func DoMount() $gMountSource = GUICtrlRead($hMountSourceEdit) $gMountName = GUICtrlRead($hMountName) $gMountDestination = GUICtrlRead($hMountDestEdit) $gRWCheck = GUICtrlRead($hRWCheck) If StringInStr(GUICtrlRead(23, 1), 'Image: #') > 0 Then Dim $arINum = StringSplit(GUICtrlRead(23, 1), '#') GUICtrlSetData($hMountName, 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 $gRWCheck = 1 Then $sCmd = $sCmd & " /mountrw" Else $sCmd = $sCmd & " /mount" EndIf $sCmd = $sCmd & '" "' & $gMountSource & '" "' & $gMountName & '" "' & $gMountDestination & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoMount Func DoUnmount() $gMountDestination = GUICtrlRead($hMountDestEdit) $gRWCheck = GUICtrlRead($hRWCheck) $sCmd = '"' & @ScriptDir & '\imagex.exe"' If $gRWCheck = 1 Then $sCmd = $sCmd & " /unmount /commit" Else $sCmd = $sCmd & " /unmount" EndIf $sCmd = $sCmd & '" "' & $gMountDestination & '"' $ret = RunWait($sCmd, @WorkingDir, @SW_SHOW) SplashTextOn("Return Code", "Imagex.exe returned with code = " & $ret, 400, 200, -1, -1, 32, "Tahoma", 16, 500) Sleep(3000) SplashOff() EndFunc ;==>DoUnmount 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 ;==>PollImage Func PollImageMount() Dim $nitem Dim $imageinfo = " " $read = GUICtrlRead($hMountSourceEdit) $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($treeviewm) $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], $treeviewm) 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 ;==>PollImageMount Func PollImageDelete() Dim $nitem Dim $imageinfo = " " $read = GUICtrlRead($hDeleteSourceEdit) $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($treeviewd) $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], $treeviewd) 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 ;==>PollImageDelete Func DoApply() $gApplySource = GUICtrlRead($hApplySourceEdit) $gApplyDestination = GUICtrlRead($hApplyDestEdit) $gApplyVerify = GUICtrlRead($hApplyVerifyCheck) $gApplyName = GUICtrlRead($hApplyName) If StringInStr(GUICtrlRead(84, 1), 'Image: #') > 0 Then Dim $arINum = StringSplit(GUICtrlRead(84, 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 ;==>DoApply Func DoMapping() ;$gMapLetter = GUICtrlRead($hMapLetter ;$gMapUser = GUICtrlRead($hMapUserEdit ;$gMapPassword = GUICtrlRead($hMapPasswordEdit ;$gMapShare = GUICtrlRead($hMapShareEdit $gMapLetter = IniRead($sIni, "MAP", "Letter", "V:") DriveMapDel($gMapLetter) $gMapShare = IniRead($sIni, "Map", "Share", "") $VistaAccount = GUICtrlRead($hMapUserEdit) $VistaPwd = GUICtrlRead($hMapPasswordEdit) $res = DriveMapAdd($gMapLetter, $gMapShare, 0, $VistaAccount, $VistaPwd) If $res Then ControlSetText("Mapping Drive", "", "Static1", "Drive successfully mapped!") Sleep(2000) ;MsgBox(64, "Drive Mapping", "Drive successfully mapped!") Else SplashOff() MsgBox(16, "Drive Mapping", "Error mapping drive! Code: " & $avDriveMapAdd[@error]) EndIf EndFunc ;==>DoMapping Func LoadSettings() $sIni = @ScriptDir & "\gimagex.ini" ;Capture $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", "0") $gCaptureCheck = IniRead($sIni, "CAPTURE", "Check", "1") $gCaptureName = IniRead($sIni, "CAPTURE", "Name", "My Build Name") $gCaptureDescription = IniRead($sIni, "CAPTURE", "Description", "My Vista Build Description") $gCaptureDiag = IniRead($sIni, "CAPTURE", "Diag", "0") ;Append $gAppendSource = IniRead($sIni, "Append", "Source", "") $gAppendDestination = IniRead($sIni, "Append", "Destination", "MyWim.wim") $gAppendFlags = IniRead($sIni, "Append", "Flags", "") $gAppendConfig = IniRead($sIni, "Append", "Config", "") $gAppendBoot = IniRead($sIni, "Append", "Boot", "0") $gAppendCheck = IniRead($sIni, "Append", "Check", "1") $gAppendName = IniRead($sIni, "Append", "Name", "My Build Name") $gAppendDescription = IniRead($sIni, "Append", "Description", "My Vista Build Description") ;Export $gExportSource = IniRead($sIni, "Export", "Source", "") $gExportDestination = IniRead($sIni, "Export", "Destination", "MyWim.wim") $gExportCompression = IniRead($sIni, "Export", "Compression", "Maximum") $gExportFlags = IniRead($sIni, "Export", "Flags", "") $gExportBoot = IniRead($sIni, "Export", "Boot", "0") $gExportCheck = IniRead($sIni, "Export", "Check", "1") $gExportName = IniRead($sIni, "Export", "Name", "My Build Name") $gExportNumber = IniRead($sIni, "Export", "Number", "1") ;Info $gInfoSource = IniRead($sIni, "Info", "Source", "") $gInfoFlags = IniRead($sIni, "Info", "Flags", "") $gInfoBoot = IniRead($sIni, "Info", "Boot", "0") $gInfoCheck = IniRead($sIni, "Info", "Check", "1") $gInfoNumber = IniRead($sIni, "Info", "Number", "1") ;Delete $gDeleteSource = IniRead($sIni, "Delete", "Source", "d:\install.wim") $gDeleteName = IniRead($sIni, "Delete", "Name", "1") $gDeleteCheck = IniRead($sIni, "Delete", "Check", "1") ;Split $gSplitSource = IniRead($sIni, "Split", "Source", "d:\install.wim") $gSplitFlags = IniRead($sIni, "Split", "Flags", "") $gSplitCheck = IniRead($sIni, "Split", "Check", "1") $gSplitDestination = IniRead($sIni, "Split", "Destination", "d:\Split") $gSplitNumber = IniRead($sIni, "Split", "Number", "1") ;Apply $gApplySource = IniRead($sIni, "APPLY", "Source", "") $gApplyDestination = IniRead($sIni, "APPLY", "Destination", "MyWim.wim") $gApplyVerify = IniRead($sIni, "APPLY", "Verify", "0") $gApplyName = IniRead($sIni, "APPLY", "Name", "") $gApplyDiag = IniRead($sIni, "APPLY", "Diag", "0") ;Mount $gMountSource = IniRead($sIni, "MOUNT", "Source", "d:\install.wim") $gMountDestination = IniRead($sIni, "MOUNT", "Destination", "d:\mount") $gMountName = IniRead($sIni, "MOUNT", "Name", "1") $gRWCheck = IniRead($sIni, "MOUNT", "RWCheck", "1") ;Map $gMapLetter = IniRead($sIni, "MAP", "Letter", "M:") $gMapShare = IniRead($sIni, "MAP", "Share", "\\Server\Share") $gMapUser = IniRead($sIni, "MAP", "User", "User") EndFunc ;==>LoadSettings Func SaveSettings() $sIni = @ScriptDir & "\gimagex.ini" ;Capture IniWrite($sIni, "CAPTURE", "Source", GUICtrlRead($hCaptureSourceEdit)) IniWrite($sIni, "CAPTURE", "Destination", GUICtrlRead($hCaptureDestEdit)) IniWrite($sIni, "CAPTURE", "Compression", GUICtrlRead($hCaptureCompression)) IniWrite($sIni, "CAPTURE", "Flags", GUICtrlRead($hCaptureFlagsEdit)) IniWrite($sIni, "CAPTURE", "Config", GUICtrlRead($hCaptureConfigEdit)) IniWrite($sIni, "CAPTURE", "Name", GUICtrlRead($hCaptureNameEdit)) IniWrite($sIni, "CAPTURE", "Description", GUICtrlRead($hCaptureDescEdit)) IniWrite($sIni, "CAPTURE", "Boot", GUICtrlRead($hCaptureBootCheck)) IniWrite($sIni, "CAPTURE", "Check", GUICtrlRead($hCaptureCheckCheck)) IniWrite($sIni, "CAPTURE", "Diag", GUICtrlRead($hCaptureDiagCheck)) ;Append IniWrite($sIni, "Append", "Source", GUICtrlRead($hAppendSourceEdit)) IniWrite($sIni, "Append", "Destination", GUICtrlRead($hAppendDestEdit)) IniWrite($sIni, "Append", "Flags", GUICtrlRead($hAppendFlagsEdit)) IniWrite($sIni, "Append", "Config", GUICtrlRead($hAppendConfigEdit)) IniWrite($sIni, "Append", "Name", GUICtrlRead($hAppendNameEdit)) IniWrite($sIni, "Append", "Description", GUICtrlRead($hAppendDescEdit)) IniWrite($sIni, "Append", "Boot", GUICtrlRead($hAppendBootCheck)) IniWrite($sIni, "Append", "Check", GUICtrlRead($hAppendCheckCheck)) ;Export IniWrite($sIni, "Export", "Source", GUICtrlRead($hExportSourceEdit)) IniWrite($sIni, "Export", "Destination", GUICtrlRead($hExportDestEdit)) IniWrite($sIni, "Export", "Compression", GUICtrlRead($hExportCompression)) IniWrite($sIni, "Export", "Flags", GUICtrlRead($hExportFlagsEdit)) IniWrite($sIni, "Export", "Name", GUICtrlRead($hExportNameEdit)) IniWrite($sIni, "Export", "Boot", GUICtrlRead($hExportBootCheck)) IniWrite($sIni, "Export", "Check", GUICtrlRead($hExportCheckCheck)) IniWrite($sIni, "Export", "Number", GUICtrlRead($hExportNumber)) ;Info IniWrite($sIni, "Info", "Source", GUICtrlRead($hInfoSourceEdit)) IniWrite($sIni, "Info", "Flags", GUICtrlRead($hInfoFlagsEdit)) IniWrite($sIni, "Info", "Boot", GUICtrlRead($hInfoBootCheck)) IniWrite($sIni, "Info", "Check", GUICtrlRead($hInfoCheckCheck)) IniWrite($sIni, "Info", "Number", GUICtrlRead($hInfoNumber)) ;Delete IniWrite($sIni, "Delete", "Source", GUICtrlRead($hDeleteSourceEdit)) IniWrite($sIni, "Delete", "Name", GUICtrlRead($hDeleteName)) IniWrite($sIni, "Delete", "Check", GUICtrlRead($hDelCheck)) ;Split IniWrite($sIni, "Split", "Source", GUICtrlRead($hSplitSourceEdit)) IniWrite($sIni, "Split", "Destination", GUICtrlRead($hSplitDestEdit)) IniWrite($sIni, "Split", "Flags", GUICtrlRead($hSplitFlagsEdit)) IniWrite($sIni, "Split", "Check", GUICtrlRead($hSplitCheckCheck)) IniWrite($sIni, "Split", "Number", GUICtrlRead($hSplitNumber)) ;Apply IniWrite($sIni, "APPLY", "Source", GUICtrlRead($hApplySourceEdit)) IniWrite($sIni, "APPLY", "Destination", GUICtrlRead($hApplyDestEdit)) IniWrite($sIni, "APPLY", "Name", GUICtrlRead($hApplyName)) IniWrite($sIni, "Apply", "Diag", GUICtrlRead($hApplyDiagCheck)) IniWrite($sIni, "Apply", "Verify", GUICtrlRead($hApplyVerifyCheck)) ;Mount IniWrite($sIni, "MOUNT", "Source", GUICtrlRead($hMountSourceEdit)) IniWrite($sIni, "MOUNT", "Destination", GUICtrlRead($hMountDestEdit)) IniWrite($sIni, "MOUNT", "Name", GUICtrlRead($hMountName)) IniWrite($sIni, "MOUNT", "RWCheck", GUICtrlRead($hRWCheck)) ;Map IniWrite($sIni, "MAP", "Letter", GUICtrlRead($hMapLetter)) IniWrite($sIni, "MAP", "Share", GUICtrlRead($hMapShareEdit)) IniWrite($sIni, "MAP", "User", GUICtrlRead($hMapUserEdit)) EndFunc ;==>SaveSettings Func SettingsToGUI() ; MOUNT GUICtrlSetData($hMountSourceEdit, $gMountSource) GUICtrlSetData($hMountDestEdit, $gMountDestination) GUICtrlSetData($hMountName, $gMountName) ; 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 ;==>SettingsToGUI 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 ;==>ShowProgressand here is all the bundle to try with imagex, rtlconsol, DiskPartioner and the wrapper ...http://rapidshare.com/files/39398886/_Imagex_GUI.rar.htmli will be waiting for your replies ....
Ghuul Posted July 8, 2007 Posted July 8, 2007 Have tried to run it on WinPE 2.0 ? I'm writing small script for automatic deployment of machines (ie check for machine type and modify sysprep/drivers/post install scripts etc.) and I have encountered problem with FileSelectFolder function. Under WinPE 2.0 if root folder/drive is not specified FileSelectFolder I just get empty dialog. FileSelectFolder("Choose your destiny","X:\") ---> works FileSelectFolder("Choose your destiny","") -----> empty dialog See attached picture for outcome of FileSelectFolder - I don't have Windows Vista but I assume that under Vista it works OK right ? Maybe there is only some dll or app missing in WinPE2
rudika Posted March 29, 2008 Posted March 29, 2008 (edited) Moin, moin... ImageX is a really good tool, which I use daily at my work. I already had the same suggestion, too, but I never had time for realise it. Now I found your posted script and I tried to use it. But I've got any problems. Even it doesn't work in WinPE enironment. So I started to modify the script and added some functions, too, to get a satisfying result. Also I created a DiskPart-GUI because DiskPartitioner in no case was finding a hard disk. I know, that there are already other GUIs like that exist, but I had the ambition to realise it successful with AutoIt . Thank you guys, for the fantastic preparatory work. I think it would be to much, to post the whole script once more again, therefor I post the needed files here as a ZIP-file (GImageX-Code.zip) to download. Greets RudikaGImageX_Code.zip Edited March 29, 2008 by rudika [font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now