Sign in to follow this  
Followers 0
JustDoIt

Function and sub-function

5 posts in this topic

I am still newbie to AutoIt.

I wrote a function that includes a sub-function. The sub-function expects a string variable from the function. I'd like to compile the sub-function into an .exe file My question here is, how do I pass the string variable to the sub-function.exe ? Something like Run(' c:\sub-function.exe "some_string" ') from my Autoit function.

Thanks for your input(s).

Share this post


Link to post
Share on other sites



Search for $CmdLine in the Help File.


There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

I tried the code below but nothing happened

If $CmdLine[0] = 1 Then 
    $aVar = $CmdLine[1]
    RunWait("c:\myScript.exe" & $CmdLine[1], "", @SW_MAXIMIZE)
endif

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I would assume that you have the command line argument in the app you want to run, not in the one you are going to pass the string from.

Main app:

;whatever
Run('"' & @HomeDrive & '\myScript.exe" ' & $sStringToPass, "", @SW_MAXIMIZE);Note the space after exe, if your string has spaces, you'll need to wrap that in quotes as well.oÝ÷ Ø
i¶­­ç÷¬
¦jwewºÚ"µÍY    ÌÍÐÛY[VÌH[ÙÐÞ
    ][ÝÚ[É][ÝË ][ÝÔÝ[Î ][ÝÈ  [È ÌÍÐÛY[VÌWJB[Y

Edit:

Blah@Edit Function!

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.

Share this post


Link to post
Share on other sites

Main app:

Run('"' & @HomeDrive & '\myScript.exe" ' & $sStringToPass, "", @SW_MAXIMIZE)

App that receives Command line:

If $CmdLine[0] Then

MsgBox(64, "info", "String: " & $CmdLine[1])

EndIf

That works great. Thanks SmOke_N.

Another question: is it possible to get a return value from "myScript.exe" back to the main script that is parsing a parameter to "myScript.exe" ?

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