Jump to content

Does autoit support VB's Optional argument?


Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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) ?

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

  • Moderators

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

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.

Link to comment
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!)

Link to comment
Share on other sites

  • Moderators

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

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.

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