cookiemonster Posted March 3, 2015 Share Posted March 3, 2015 Hi all, I have the following script, which I am trying to make it possible to run it from a cmd prompt with a flag on the end so it runs under a different manner... Example: If I double click run.au3 (or run.exe when compiled) it opens notepad.exe maximized. But if i run it from cmd prompt as "run.au3 /min" or "run.exe /min I want it to change $aflag so it runs the second part of the if else statement. Does anyone know how I would go abouts this sort of exercise? Global $aflag = "" Example() Func Example() If $aflag = "" Then Local $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED) Else Local $iPID = Run("notepad.exe", "", @SW_SHOWMINIMIZED) EndIF EndFunc Link to comment Share on other sites More sharing options...
Radiance Posted March 3, 2015 Share Posted March 3, 2015 https://www.autoitscript.com/autoit3/docs/intro/running.htm Check the "Command Line Parameter" part. Link to comment Share on other sites More sharing options...
TheSaint Posted March 3, 2015 Share Posted March 3, 2015 (edited) If $CmdLine[0] <> "" Then $aflag = $CmdLine[1] Else $aflag = "" EndIf That's the basics of it, that you can put at the start of your script. I would read up about it though. You also need to do your own additional testing for "/min" P.S. I was sure they had an example like that in the Help file etc, but it seems to have been modified and removed, which doesn't make it easy for a beginner. Edited March 3, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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