Sign in to follow this  
Followers 0
cappy2112

Does autoit support VB's Optional argument?

8 posts in this topic

I've looked through the help file and forum for references to Optional argument passing, but I may be using the wrong name.

Does AutoIt support the Optional argument passing from Visual Basic 6

that is

sub MySub(Arg1 as integer, Optional: Arg2 as String)

With this declaration, I can call MySub with one or two arguments.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well as far as passing VB commands, I don't know the "exact" answer, as I know nothing of VB, but if I had to guess, I would say take a look at: StderrRead, StdoutRead, StdinWrite in the help file. Maybe have your VB write it out, and have autoit read it and carry it out.

Most threads I've read though, are vice versa, AutoIt being used for special commands within VB not the other way around as I'm interpreting your post.

Edit:

Fixed spelling.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well as far as passing VB commands, I don't know the "exact" answer, as I know nothing of VB, but if I had to guess, I would say take a look at: StderrRead, StdoutRead, StdinWrite in the help file. Maybe have your VB write it out, and have autoit read it and carry it out.

Most threads I've read though, are vice versa, AutoIt being used for special commands within VB not the other way around as I'm interpreting your post.

Edit:

Fixed spelling.

I don't think you got my point-let me try to rephrase it.

Can an AutoIt function take a variable number of Arguments- that is if it is defined with 3 args,

Can I call it with only 2- where the last argument is can be passed or not passed, without causing a runtime (or compile error) ?

Share this post


Link to post
Share on other sites

I've looked through the help file and forum for references to Optional argument passing, but I may be using the wrong name.

Does AutoIt support the Optional argument passing from Visual Basic 6

that is

sub MySub(Arg1 as integer, Optional: Arg2 as String)

With this declaration, I can call MySub with one or two arguments.

Yes but they need to have a default value se Func... EndFunc Help

Share this post


Link to post
Share on other sites

Yes but they need to have a default value se Func... EndFunc Help

$optionalpar1 = value,

That's it !

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't think you got my point-let me try to rephrase it.

Can an AutoIt function take a variable number of Arguments- that is if it is defined with 3 args,

Can I call it with only 2- where the last argument is can be passed or not passed, without causing a runtime (or compile error) ?

Would you like to post what you have tried to do to accomplish this, since "Obvioulsy" you have tried and failed (Right?)... and maybe someone could tell you where you were right and wrong at or if at all possible the way your trying. (Or have you not tired, and this is just a general question).

Edit:

Args('I hope I am not crazy', "Because I'm not understanding your post")

Func Args($Arg1, $Arg2, $Arg3 = 'Have you tried?')
    MsgBox(0, 'Test', $Arg1 & @CRLF & $Arg2 & @CRLF & $Arg3 & @CRLF & 'This function was only called with 2 of the 3 possible arguements (parameters).')
EndFunc
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Would you like to post what you have tried to do to accomplish this, since "Obvioulsy" you have tried and failed (Right?)... and maybe someone could tell you where you were right and wrong at or if at all possible the way your trying. (Or have you not tired, and this is just a general question).

Edit:

Args('I hope I am not crazy', "Because I'm not understanding your post")

Func Args($Arg1, $Arg2, $Arg3 = 'Have you tried?')
    MsgBox(0, 'Test', $Arg1 & @CRLF & $Arg2 & @CRLF & $Arg3 & @CRLF & 'This function was only called with 2 of the 3 possible arguements (parameters).')
EndFunc
In my previous post (the one originated by jpm) I mentioned that his answer is what i"m looking for

(ie That's it!)

Share this post


Link to post
Share on other sites

In my previous post (the one originated by jpm) I mentioned that his answer is what i"m looking for

(ie That's it!)

Yeah, I saw those after I had already posted... Good to know!! :o

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0