Jump to content

Convert simple VBS in AU3


Recommended Posts

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

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