国外源代码#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.10.0
Author: Bj�rn Kaiser
Script Function:
Use Gimagex_com wrapper
#ce ----------------------------------------------------------------------------
#include-once
;===============================================================================
;
; Function Name: _gimagex_capture()
; Description: Captures a Folder to a .WIM-file
; Parameter(s):
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @error Value(s):
; Author(s):
;
;===============================================================================
Func _gimagex_capture(ByRef $oWIM, $sSource, $sDest, $sName, $sDesc = 0, $sFlags = 0, $bCheck = 0, $bVer = 0, $bBoot = 0)
;~ Local $oWIM
; Parameter Checking
;===============================================================================
If Not IsString($sSource) Then
SetError(1)
Return 0
EndIf
If Not IsString($sDest) Then
SetError(2)
Return 0
EndIf
If Not IsString($sName) Then
SetError(3)
Return 0
EndIf
;===============================================================================
;~ $oWIM = ObjCreate("GImageX.GImageXCtrl")
If IsObj($oWIM) Then
With $oWIM
.Source = $sSource
.Destination = $sDest
.ImageName = $sName
If $sDesc Then .Description = $sDesc
If $sFlags Then .Flags = $sFlags
If $bCheck Then
.Check = True
Else
.Check = False
EndIf
If $bVer Then
.Verify = True
Else
.Verify = False
EndIf
If $bBoot Then
.Bootable = True
Else
.Bootable = False
EndIf
EndWith
$oWIM.CaptureImage
Else
SetError(9)
Return 0
EndIf
;~ $oWIM = 0
Return 1
EndFunc ;==>_gimagex_capture
;===============================================================================
;
; Function Name: _gimagex_apply()
; Description: Applies a .WIM-file to a path
; Parameter(s):
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @error Value(s):
; Author(s):
;
;===============================================================================
Func _gimagex_apply(ByRef $oWIM, $sSource, $sDest, $iImage, $bCheck = 0, $bVer = 0)
;~ Local $oWIM
; Parameter Checking
;===============================================================================
If Not IsString($sSource) Then
SetError(1)
Return 0
EndIf
If Not IsString($sDest) Then
SetError(2)
Return 0
EndIf
If Not IsInt($iImage) Then
SetError(3)
Return 0
EndIf
;===============================================================================
;~ $oWIM = ObjCreate("GImageX.GImageXCtrl")
If IsObj($oWIM) Then
With $oWIM
.Source = $sSource
.Destination = $sDest
.Image = $iImage
If $bCheck Then
.Check = True
Else
.Check = False
EndIf
If $bVer Then
.Verify = True
Else
.Verify = False
EndIf
EndWith
$oWIM.ApplyImage
Else
SetError(9)
Return 0
EndIf
;~ $oWIM = 0
Return 1
EndFunc ;==>_gimagex_apply
;===============================================================================
;
; Function Name: _gimagex_object()
; Description: Creates a GImageX object
; Parameter(s):
; Return Value(s): On Success - Returns GImageX object
; On Failure - Returns 0
; @error Value(s):
; Author(s):
;
;===============================================================================
Func _gimagex_object()
Local $oWIM
$oWIM = ObjCreate("GImageX.GImageXCtrl")
If IsObj($oWIM) Then
Return $oWIM
Else
Return 0
EndIf
EndFunc
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.10.0
Author: Bj�rn Kaiser
Script Function:
#ce ----------------------------------------------------------------------------
Opt("MustDeclareVars", 1)
#include <gimagex_com.au3>
Dim $iRC, $oWIM, $oEvent
$oWIM = _gimagex_object()
If $oWIM Then
$oEvent = ObjEvent($oWIM, "ImageXEvent_")
ProgressOn("ImageX", "Please wait ...")
$iRC = _gimagex_capture($oWIM, "D:\projects", "D:\test.wim", "test")
ConsoleWrite("RC:" & @TAB & $iRC & @CRLF & "@error:" & @TAB & @error & @CRLF)
$oEvent = 0
$oWIM = 0
ProgressOff()
EndIf
Func ImageXEvent_Progress($iPercent, $iSeconds)
ProgressSet($iPercent, "ETA: " & $iSeconds & " seconds")
ConsoleWrite("ETA:" & @TAB & @TAB & $iSeconds & @CRLF & "Progress:" & @TAB & $iPercent & @CRLF)
EndFunc ;==>ImageXEvent_Progress
|