Jump to content

Another VBScript to AU3


ofLight
 Share

Recommended Posts

Can anyone help me with this Translation? I have started to convert it over but am haveing trouble with the last part ;)

this is the Original

Dim objSmartWIM, ResultCode

Set objSmartWIM = WScript.CreateObject("SmartWIM", "objSmartWIM_")

objSmartWIM.File = "C:\Image.wim"

objSmartWIM.Image = "My Test Image"

objSmartWIM.Path = "C:\Dell"

objSmartWIM.Temp = "C:\WINDOWS\Temp"

ResultCode = objSmartWIM.CaptureImage(False)

WScript.Echo objSmartWIM.GetErrorDescription(ResultCode)

Set objSmartWIM = Nothing

 

Sub objSmartWIM_Progress(ByVal nPercent, ByVal nSeconds)

WScript.Echo nPercent & "% complete, " & nSeconds & " remaining"

End Sub

Obveously I am screwin it up :)

Dim $objSmartWIM, $ResultCode

$objSmartWIM = ObjCreate("SmartWIM")

$objSmartWIM.File = "C:\Image.wim"

$objSmartWIM.Image = "My Test Image"

$objSmartWIM.Path = "C:\Dell"

$objSmartWIM.Temp = "C:\WINDOWS\Temp"

$ResultCode = $objSmartWIM.CaptureImage(False)

GUICreate("SmartWIM",400,75)
Global $Label = GUICtrlCreateLabel( $objSmartWIM.GetErrorDescription($ResultCode) ,10,10)
Global $progress = GUICtrlCreateProgress(10,40)
GUISetState(@SW_SHOW)

$objSmartWIM = ""
 

;Sub objSmartWIM_Progress(ByVal nPercent, ByVal nSeconds)
    ;WScript.Echo nPercent & "% complete, " & nSeconds & " remaining"
;End Sub

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Alright, Ive been pooring over the Forums and Help file and am pretty sure the correct translation of that last part is going to involve "ObjEvent", But I could really use any Suggestions or help on this.

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Thanks for the Comment Psalty, I actually already read that post, and it did help me to get started with the direct commands like Creation and Capture. Unfortunatly it doesnt show howto handle incoming events, such as the progress bar % and such.

I think I am getting closer but still no Cegar

Dim $objSmartWIM, $ResultCode

$objSmartWIM = ObjCreate("SmartWIM")
$SinkObject=ObjEvent($objSmartWIM,"objSmartWIM_")

$objSmartWIM.File = "C:\Image.wim"

$objSmartWIM.Image = "My Test Image"

$objSmartWIM.Path = "C:\Dell"

$objSmartWIM.Temp = "C:\WINDOWS\Temp"

$ResultCode = $objSmartWIM.CaptureImage(False)

ProgressOn("SmartWIM", "")

MsgBox(0, $objSmartWIM.GetErrorDescription($ResultCode),"")

$objSmartWIM = 0

Func objSmartWIM_Progress( $nPercent, $nSeconds)
  $percent = Int( ($nPercent * 100) / 200 )
  If $percent >= 0 And $percent <= 100 Then
    ProgressSet ( $percent , $nSeconds & " Seconds to go." , "Creating WIM" )
  EndIf
EndFunc

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Ok, I think I have correctly translated the script from the original, however it still doesnt work. I am recieving some of the Events, but only at the end of the script, basicly the same problem from the other thread Psalty mentioned. Can anyone tell if it looks like I am useing ObjEvent correctly ?

Dim $objSmartWIM, $ResultCode

$objSmartWIM = ObjCreate("SmartWIM")
$EventObject=ObjEvent($objSmartWIM,"Event_")

$objSmartWIM.File = "C:\Image.wim"

$objSmartWIM.Image = "My Test Image"

$objSmartWIM.Path = "C:\Dell"

$objSmartWIM.Temp = "C:\WINDOWS\Temp"

$ResultCode = $objSmartWIM.CaptureImage(False)

MsgBox(0, $objSmartWIM.GetErrorDescription($ResultCode),"")

$objSmartWIM = 0

Func Event_Progress( $nPercent, $nSeconds)
    MsgBox(0,"", $nPercent& "% complete, " & $nSeconds & " remaining",2)
EndFunc

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

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...