Last active
February 18, 2019 17:45
-
-
Save davebrny/f7cbde0d89a5c99cec554e46ba94db11 to your computer and use it in GitHub Desktop.
(autohotkey) - get the parameters that have been passed to the script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passed() { | |
global 0 | |
loop, %0% | |
params .= (params ? a_space : "") . %a_index% | |
return params | |
} | |
/* | |
[script info] | |
description = get the parameters that have been passed to the script | |
*/ |
loop, %0%
params .= (params ? a_space : "") . %a_index%
expanded example:
number_of_parameters = %0% ; get the number of parameters that have been passed to the script
loop, % number_of_parameters ; loop that many times
{
this_loop_number = %a_index% ; 1, 2, 3 etc
value_in := %this_loop_number% ; get the value stored in this loop number, %1% %2% %3%
if (parameters != "") ; if the variable already contains a parameter(s)
space_before := a_space ; then add a space between
else space_before := "" ; else its the first parameter so no space is needed
parameters .= space_before . value_in ; append to current parameters .=
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docs: passing command line parameters to a script