| View previous topic :: View next topic |
| Author |
Message |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Thu Feb 24, 2005 2:52 pm Post subject: Passing Command Line Parameters to a Non-Compiled Script ? |
|
|
Compiled scripts accept parameters, see quote from help. | Quote: | Passing Command Line Parameters to a Script
Scripts support command line parameters. The format is:
CompiledScript.exe [Switches] [Script Parameters]
[...]
Script Parameters can be any strings you want to pass into the script (but any string that contains spaces must be enclosed in double quotes). The script sees incoming parameters as the variables %1%, %2%, and so on. In addition, %0% contains the number of parameters passed (0 if none). | But how can I hand a parameter over to a non-compiled script?
I tried this, but without success:
| Code: | | Run, %ScriptFilename%.ahk %Parameter% |
Do I have to use a ini-file to transfer the parameter or is there another way?
Thank you in advance for any hint/help. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Thu Feb 24, 2005 3:27 pm Post subject: |
|
|
test.ahk:
Start | Run... | test.ahk Hello! | Ok |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Feb 24, 2005 3:38 pm Post subject: |
|
|
The format is in the help file but somehow got omitted from the section you quoted:
AutoHotkey.exe [Switches] [Script Filename] [Script Parameters] |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Thu Feb 24, 2005 3:56 pm Post subject: |
|
|
I have two files:
mystart.ahk: | Code: | | Run, mytest.ahk Hallo |
and mytest.ahk:
But when I start mystart.ahk it give the following message from mystart.ahk:
| Quote: | Error: Failed attempt to launch program or document:
Action: <mytest.ahk Hallo>
Params: <>
[...]
--> Run,test.ahk Hallo |
And when I start mytest in a shell with "mytest.ahk Hallo" I get a message window with 0 and nothing, as if nothing is handed over.
Any idea?
[...Thinking...]
Forget about the above, I read Chris again and again. I could get the meaning, but since he doesn't post nonsense. I was missing something. And it was the missing of "Autohotkey.exe" in my script, so mystart.ahk has to be | Code: | | Run, AutoHotkey.exe test.ahk Hallo |
I didn't understood the help file in that case. Could you maybe extend that section, so that other do not fall into the same trap. Something like this | Quote: | Scripts support command line parameters. For non-compiled scripts the format is:
AutoHotkey.exe [Switches] [Script Filename] [Script Parameters]
For compiled scripts the format is:
CompiledScript.exe [Switches] [Script Parameters]
|
Thanks for the help. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Feb 24, 2005 10:49 pm Post subject: |
|
|
| toralf wrote: | | Could you maybe extend that section, so that other do not fall into the same trap. | Thanks. I have made that change and it seems clearer now. |
|
| Back to top |
|
 |
|