ca143508 Posted July 10, 2006 Share Posted July 10, 2006 Hey Guys, I have a script with different functions in it. What I would like to do is have a switch in it so that I can run my script from a specific function. At the moment when I run the exe version it goes in a loop until a certain system time is matched and then works it's way through the functions until the end of the script. However if I ran C:\myprog.exe /m (for example) it would skip the time check and run the rest of the functions. Is there such a way that autoit can do this? Thanks heaps Mike. Link to comment Share on other sites More sharing options...
evilertoaster Posted July 10, 2006 Share Posted July 10, 2006 Look at the help file under "command line parameters" excerpt: 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". 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 10, 2006 Share Posted July 10, 2006 Hey Guys, I have a script with different functions in it. What I would like to do is have a switch in it so that I can run my script from a specific function. At the moment when I run the exe version it goes in a loop until a certain system time is matched and then works it's way through the functions until the end of the script. However if I ran C:\myprog.exe /m (for example) it would skip the time check and run the rest of the functions. Is there such a way that autoit can do this? Thanks heaps Mike. Check out Command Line Parameters in the help file. If you script is compiled and run as: C:\myprog.exe /m, then $CmdLine[0] = 1 (count of parameters), and $CmdLine[1] = "/m". So you get: If $CmdLine[0] = 0 ; No command line parameters MsgBox(64, "MyProg", "No commandline parameters used.") ElseIf $CmdLine[1] = "/m" Then ; /m parameter was used MsgBox(64, "MyProg", "Switch 'm' was used.") Else MsgBox(16, "Error!", "Invalid commandline argument, not '/m'.") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ca143508 Posted July 10, 2006 Author Share Posted July 10, 2006 Look at the help file under "command line parameters"excerpt:Thanks for this. I was just having a bit of trouble getting my head around the help file explanation. Appreciate your help. Link to comment Share on other sites More sharing options...
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