AutoHotKey's %0% (number of command line arguments) produces inconsitent results

125 views Asked by At

In AutoHotKey the way to see how many command line arguments are provided is %0%. This works well sometimes, however in the example below when it is part of a string concatenation it doesn't return the number of arguments. Instead it returns the last argument's value.

MsgBox %0%    ; here is does show the number of arguments
MsgBox %1%    ; and the contents of the first one...
MsgBox %2%    ; second one...
MsgBox %3%    ; third one...


STRING := %0%
MsgBox %STRING% ; this should be the number of
              ; arguments but instead it is
              ; the last argument
exit
1

There are 1 answers

0
Elliot DeNolf On

If you simply change the line STRING := %0% to STRING = %0%, you will get the desired result.