Other Software > Developer's Corner
Help with autohotkey: Command line switches
justice:
I'm not sure what you're trying to get achieved but i think this is what you're looking for:
--- ---mycommand=%1%
myothercommand=%2%
myotherothercommand=%3%
If mycommand = 1
{
MsgBox, success
}
else
If myothercommand = 1
{
MsgBox, failure
}
else
If myotherothercommand = 1
{
MsgBox, nothing
}
ExitApp
then call it like this:
* argumenttest 1
* argumenttest 0 1first one will show success, second one failure
wreckedcarzz:
Ah, OK. I think I understand now. I was messing up the parameters and then messed up the code. :P
EDIT: I am still lost, it keeps launching all the options at once. I am going to keep messing with the code to see what I am doing wrong.
MilesAhead:
I have to say I never had such a struggle trying to get a switch off a command line. Then to make it even more fun the Scite param passing tool in the editor is broken!!! Sheesh!!
All I'm trying to do is loop through the params and if the first is
/q do "quiet mode" but I can't even detect the /q. It's really bizarre.
MilesAhead:
seems like the only method that works at all is
Loop %0%
anything else, the value is blank. really weird
wr975:
Here's my version. ;) (Edited to a simplier version.)
--- ---loop
{
switch := %a_index%
if switch =
break
If switch = /h
msgbox, Command line parameter /h detected
If switch = /help
msgbox, Command line parameter /help detected
If switch = /hidden
msgbox, Command line parameter /hidden detected
}
Command line switches work in any order. Example:
scriptname /h
scriptname /h /hidden
scriptname /hidden /help /h
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version