Simmy Posted June 14, 2011 Share Posted June 14, 2011 Hi guys, Id like to learn how for example, in the following code: If $CmdLine[0] = 0 Then MsgBox(64, "Result", "No parameter was entered!") Exit EndIf MsgBox(64, "Entry", $CmdLine[1]) You can add help information for the user, displayed at the command line. For example, if at a command line, the user enters: c:\test.exe A msgbox will appear saying that "no parameter was entered". What I would like is, if no parameter was entered, or the user types: c:\test.exe /? Then information will appear in the command window stating application usage, eg: Usage: test.exe param1 Any help greatly appreciated. Link to comment Share on other sites More sharing options...
smashly Posted June 14, 2011 Share Posted June 14, 2011 Hi,compile and tryIf $CmdLine[0] = 0 Then MsgBox(64, "Result", "No parameter was entered!") Exit Else Switch $CmdLine[1] Case "/?" MsgBox(64, "Help", "Usage: " & @AutoItExe & " /param1") Case "/param1" MsgBox(64, "param1", "1st parameter received: " & $CmdLine[1]) If $CmdLine[0] > 1 Then ContinueCase Case Else MsgBox(64, "Commandline Raw", "$CmdLineRaw: " & $CmdLineRaw) EndSwitch EndIf Cheers Link to comment Share on other sites More sharing options...
Simmy Posted June 14, 2011 Author Share Posted June 14, 2011 Hi Smashly, thanks so much for your kind help. That works Smashly, but what I really wanted was to write the output not to a msgbox, but to a command line prompt. I tried the following: If $CmdLine[0] = 0 Then MsgBox(64, "Result", "No parameter was entered!") Exit Else Switch $CmdLine[1] Case "/?" ;MsgBox(64, "Help", "Usage: " & @AutoItExe & " /param1") ConsoleWrite ("sdf") Case "/param1" MsgBox(64, "param1", "1st parameter received: " & $CmdLine[1]) If $CmdLine[0] > 1 Then ContinueCase Case Else ; MsgBox(64, "Commandline Raw", "$CmdLineRaw: " & $CmdLineRaw) consolewrite ("nos") EndSwitch EndIf And this worked in Scite, but not at a prompt. Link to comment Share on other sites More sharing options...
Simmy Posted June 14, 2011 Author Share Posted June 14, 2011 Hi guys, I just did some research on ConsoleWrite, where it said that: "This does not write to a DOS console unless the script is compiled as a console application." http://www.autoitscript.com/autoit3/docs/functions/ConsoleWrite.htm So, I compiled it with CUI instead of GUI.exe and it worked. I just thought I would put it here for others to see. Thanks for your help. Link to comment Share on other sites More sharing options...
Zedna Posted June 14, 2011 Share Posted June 14, 2011 You can add this at top of your script #AutoIt3Wrapper_Change2CUI=y Then you can simply compile it by F5 directly from Scite Resources UDF ResourcesEx UDF AutoIt Forum Search 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