Pieter Posted August 24, 2006 Posted August 24, 2006 How can I pass a parameter like this:myprogram.exe /nosplashto an AutoIt program and catch it? iPod + Online calendars = iPodCALsync
CWorks Posted August 24, 2006 Posted August 24, 2006 (edited) If $CmdLine[0] = 1 Then $something = $CmdLine[1] EndIf If $CMDLINE[0]= 1 Then If $CMDLINE[1] = " /nosplash" Then ; do something EndIf Edited August 24, 2006 by CWorks
Valuater Posted August 24, 2006 Posted August 24, 2006 Command Line Parameters The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script. Note the scriptname is not classed as a parameter; get this information with @ScriptName instead. A parameter that contains spaces must be surrounded by "double quotes". <a href="compiler.htm">Compiled scripts accept command line parameters in the same way. $CmdLine[0] is number of parameters $CmdLine[1] is param 1 (after the script name) $CmdLine[2] is param 2 etc ... $CmdLine[$CmdLine[0]] is one way to get the last parameter... So if your script is run like this: AutoIt3.exe myscript.au3 param1 "this is another param" $CmdLine[0] equals... 2 $CmdLine[1] equals... param1 $CmdLine[2] equals... this is another param @ScriptName equals... myscript.au3 In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example: $CmdLineRaw equals... myscript.au3 param1 "this is another param" If the script was compiled it would have been run like this: myscript.exe param1 "this is another param" $CmdLineRaw equals... param1 "this is another param" Note that $CmdLineRaw just return the parameters. per help 8)
Pieter Posted August 24, 2006 Author Posted August 24, 2006 @CWorks: thanks, that's what I was looking for. @Valuater: congratulations on your 4800th post. iPod + Online calendars = iPodCALsync
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now