KXP Posted April 25, 2011 Share Posted April 25, 2011 (edited) Hi. I need to make a console script which will be able to accept some command line options as its input and then compile it to exe with Aut2Exe (the 2nd part doesn't make any problems). But I have no idea how to do it. Please help me guys. Thanks. Edited April 25, 2011 by KXP Link to comment Share on other sites More sharing options...
wakillon Posted April 25, 2011 Share Posted April 25, 2011 (edited) Something like this ? If $Cmdline[0] Then For $_I = 1 To $Cmdline[0] Switch $Cmdline[$_I] Case '/?','-?','/help','-help' Exit MsgBox (0x40000, StringTrimRight ( @ScriptName, 4 ) & ' Help', 'Switches are:' & @LF _ & @LF & '/extract' _ & @LF & @TAB & 'Extract files to current directory' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/y' _ & @LF & @TAB & '' _ & @LF & '/z' _ & @LF & @TAB & '') Case '/x' Case '/y' Case '/z' Case Else Exit MsgBox ( 262144, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw & @LF & @LF & 'Use /? for the Switches available.' ) EndSwitch Next EndIf Edited April 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LurchMan Posted April 25, 2011 Share Posted April 25, 2011 (edited) Something like this ? If $Cmdline[0] Then For $_I = 1 To $Cmdline[0] Switch $Cmdline[$_I] Case '/?','-?','/help','-help' Exit MsgBox (0x40000, StringTrimRight ( @ScriptName, 4 ) & ' Help', 'Switches are:' & @LF _ & @LF & '/extract' _ & @LF & @TAB & 'Extract files to current directory' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/y' _ & @LF & @TAB & '' _ & @LF & '/z' _ & @LF & @TAB & '') Case '/x' Case '/y' Case '/z' Case Else Exit MsgBox ( 262144, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw & @LF & @LF & 'Use /? for the Switches available.' ) EndSwitch Next EndIf Not trying to hijack this thread, but is it a typo or did you mean to code it like this and if so out of curiosity why? Exit MsgBox ( 262144, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw & @LF & @LF & 'Use /? for the Switches available.' ) Edited April 25, 2011 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
wakillon Posted April 25, 2011 Share Posted April 25, 2011 Not trying to hijack this thread, but is it a typo or did you mean to code it like this and if so out of curiosity why? Exit MsgBox ( 262144, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw & @LF & @LF & 'Use /? for the Switches available.' ) Don't worry about this, it's just to save space ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
KXP Posted April 25, 2011 Author Share Posted April 25, 2011 (edited) wakillon, Thank you very much!Can I ask 1 more question?I'm launching an application in console using AutoIt (Run function).In some cases the application outputs a prompt to the console and if this prompt appears the script should send some data (input a string & press enter, I think could be done with ControlSend function).So how can I wait for that prompt in my script?I know this prompt and can specify it.Thanks a lot. Edited April 25, 2011 by KXP Link to comment Share on other sites More sharing options...
wakillon Posted April 25, 2011 Share Posted April 25, 2011 A dos console ?It would be better, if you post this part of your script ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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