Jump to content
Sign in to follow this  
charlin

Convert simple VBS in AU3

Recommended Posts

charlin

Hello, I try to convert simple VBS in AU3 but a i have always a error when i call a method. Why

VBS works great, always the 80020009 COM error when a call FindVirtualMachine method in AU3!

The VBS

On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")

Set objVM = objVS.FindVirtualMachine("frmtzzl01")

objVM.Startup()

The AU3

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler 
$VS =ObjCreate("VirtualServer.Application")
If not IsObj($VS) Then
 MsgBox(0,"","Not a object")
Endif
$VM =$VS.FindVirtualMachine("frmtzzl01")
If not IsObj($VM) Then
 MsgBox(0,"","Not a object 2")
Endif
;$VM.Startup
Exit 
; This is my custom error handler 
Func MyErrFunc() 
   $HexNumber=hex($oMyError.number,8) 
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription ) 
   SetError(1) ; something to check for when this function returns 
Endfunc
Edited by charlin

Share this post


Link to post
Share on other sites
charlin

More simple and i dont work. COM object work correctly in AutoIT ??

IN VBS

Set objVS = CreateObject("VirtualServer.Application")

Wscript.Echo objVS.Name

return nomaly "VirtualServer"

IN AU3

$VS =ObjCreate("VirtualServer.Application")
If not IsObj($VS) Then
 MsgBox(0,"","Not a object")
Endif
MsgBox(0,"",$VS.Name)

return empty string !!!!!!!!!

Whats append, $VS is a object and @error return 0 when call ObjCreate .... hummmm

Edited by charlin

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.