Jump to content

AutoIT in Windows PE 2.0


Recommended Posts

Hi,

I've got a few questions concering AutoIT and Windows PE 2.0. I need to capture an image to provide it via WDS. Since we don't have a WDS server around here I built a small GUI which ask the user wether one wants to configure the capture process manually or wether this should be done automatically. The first issue I ran into was the FolderOpenDialog which doesn't work properly. The windows opens but without any content (except the buttons and title bar). So does anybody know which DLL's are involved in the FolderOpenDialog? I already included WMI, MDAC and the Windows Scritping Host which didn't help at all.

Here's the code:

#include <GUIconstants.au3>
#include <Process.au3>

Dim $config_file = "X:\Windows\System32\customwdscapture.inf"
Dim $date = @MDAY & "." & @MON & "." & @YEAR

GUICreate("OS Capture Wizard",250,220)  
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel ("Please choose a capture method:", 30,20,180,20)
$opt_auto = GUICtrlCreateRadio ("automatic capturing", 40,60,120,20)
    GUICtrlCreateLabel ("save image to:", 60,90,100,20)
    $save_to = GUICtrlCreateButton ( "choose...", 150,85,60,22)
            GUICtrlSetOnEvent ( $save_to , "save_wim" )
    $path = GUICtrlCreateInput ( "", 60,120,160,20)
            
$opt_man = GUICtrlCreateRadio ("manual capturing using wdsutil.exe", 40,140,180,30)

$start = GUICtrlCreateButton ( "start capturing", 130,180,90,25)
    GUICtrlSetOnEvent ( $start, "start_cap" )


GUICtrlSetState ($opt_auto, $GUI_CHECKED)
GUISetState (@SW_SHOW)

While 1
  Sleep(1000)
WEnd

Func save_wim()
    $select_folder = FileSelectFolder ( "Choose folder to save image", "", 1)
    GUICtrlSetData ( $path , $select_folder )
EndFunc

Func start_cap()
    $auto_state = GUICtrlGetState ( $opt_auto )
    $man_state = GUICtrlGetState ( $opt_man )
    $cap_path = GUICtrlRead ( $path )
    If $auto_state = $GUI_CHECKED Then
        IniWrite ( $config_file , "Capture", "DestinationFile", $cap_path & "captured_" & $date & ".wim" )
        IniWrite ( $config_file , "Capture", "ImageName", "captured_" & $date )
        IniWrite ( $config_file , "Capture", "ImageDescription", "captured_" & $date )
        _RunDOS ( "X:\Windows\System32\wdscapture.exe /UnattendFilePath:" & $config_file )
        Exit
    ElseIf $man_state = $GUI_CHECKED Then
        Run ( "X:\Windows\System32\wdscapture.exe" )
        Exit
    EndIf
EndFunc

Func CLOSEClicked()
Exit
EndFunc

Thanks in advance, Bastian

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...