Jump to content
Sign in to follow this  
Michel Claveau

Use VBscript with AutoIt : a method

Recommended Posts

Use VBS with AutoIt ? It's possible. It's easy.

Follow this example :

;;; Michel Claveau Informatique

;;; http://mclaveau.com

$code=                "Function mul2(x)"

$code=$code & @CRLF & "mul2=x*2"

$code=$code & @CRLF & "end Function"

$code=$code & @CRLF

$code=$code & @CRLF & "Function mul3(x)"

$code=$code & @CRLF & "mul3=x*3"

$code=$code & @CRLF & "end Function"

$code=$code & @CRLF

$code=$code & @CRLF & "Function mul4(x)"

$code=$code & @CRLF & "mul4=x*4"

$code=$code & @CRLF & "end Function"

MsgBox(0,"Code VBS définit :",$code)

$vbs = ObjCreate("ScriptControl")

$vbs.language="vbscript"

$vbs.addcode($code)

$vbs.eval("MsgBox(""VBscript commence"",vbinformation,""Salut"")")

$retour = $vbs.eval("mul2(123)")

MsgBox(0,"Valeur retournée par VBS",$retour)

$v=222

$retour = $vbs.run("mul3",$v)

MsgBox(0,"Avec passage de paramètre",$retour)

$retour = $vbs.run("mul4",$v)

MsgBox(0,"Test de vérification",$retour)

(And, like said : MHz : Latest Autoit Beta Version is required)

ça s'arrose, non ? Tchin-tchin à tous ! :)

Edited by Michel Claveau

Share this post


Link to post
Share on other sites

Use VBS with AutoIt ?  It's possible. It's easy.

ça s'arrose, non ?  Tchin-tchin à tous !    :)

<{POST_SNAPBACK}>

And, the same way open the scripting with JScript (inside AutoIt)

Have you :D s ?

Share this post


Link to post
Share on other sites

Use VBS with AutoIt ?  It's possible. It's easy.

Follow this example : 

ça s'arrose, non ?  Tchin-tchin à tous !    :)

<{POST_SNAPBACK}>

ERROR: ObjCreate(): undefined function.

                      $vbs = ObjCreate("ScriptControl)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Michel,

I received this message when running your script. What up??? :D

Share this post


Link to post
Share on other sites

Hi, Michael,

I am asking in ignorance; would you prefer to do this than just run a vbs script from Autoit?

Randall

<{POST_SNAPBACK}>

Hi !

With COM's calls, for play VBS, it's possible to share variables with AutoIt.

But, for me, it was only un fun test...

:)

Share this post


Link to post
Share on other sites

Hi !

With COM's calls, for play VBS, it's possible to share variables with AutoIt.

But, for me, it was only un fun test...

:)

<{POST_SNAPBACK}>

looks like this method would make a good .vbs to exe wrapper,

if you complied the .au3


I've been on the net so long, I remember when I could only e-mail myself!

Share this post


Link to post
Share on other sites

Michel,

I received this message when running your script. What up??? :)

<{POST_SNAPBACK}>

@busysignal

You are missing the closing quote after ScriptControl, should be:

$vbs = ObjCreate("ScriptControl")

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...