Page 1 of 1

Cmd line bug

Posted: 30 Nov 2017, 06:13
by coffee
Not sure if it's a matter of no one using command line arguments with autohotkey_h, or that no one uses autohotkey_h v2, or a mixture of both, but, since release 2 a081 H003 (oldest one I have) autohotkey_h has been unable to parse cmd line args properly.
It repeats the arguments. This issue doesn't happen with lexikos' version.

To reproduce

Ahk file

Code: Select all

for k,v in a_args
	msgbox v
Command prompt

Code: Select all

autohotkey.exe autohotkey.ahk first second third
Above results in first second third second passed to the script.

Command prompt

Code: Select all

autohotkey.exe autohotkey.ahk first second third fourth
Above results in first second third fourth second fourth passed to the script.

Re: Cmd line bug

Posted: 30 Nov 2017, 14:41
by HotKeyIt
It is not a bug, it is a feature but I forgot to mention it in docs.
If you want to access passed parameters one by one you will need to use:

Code: Select all

Loop A_Args.length()
  MsgBox A_Index "`n" A_Args[A_Index]
Additionally in your example you can access parameters by name:A_Args.first = "second" and A_Args.third = "fourth"

Re: Cmd line bug

Posted: 30 Nov 2017, 18:49
by coffee
HotKeyIt wrote:It is not a bug, it is a feature but I forgot to mention it in docs.
If you want to access passed parameters one by one you will need to use:

Code: Select all

Loop A_Args.length()
  MsgBox A_Index "`n" A_Args[A_Index]
Additionally in your example you can access parameters by name:A_Args.first = "second" and A_Args.third = "fourth"
Like a security feature? or what does it provide? can you link a commit?

Re: Cmd line bug

Posted: 30 Nov 2017, 20:41
by HotKeyIt
No this is a feature to pass command line parameters by name, see here: https://github.com/HotKeyIt/ahkdll/blob ... t.cpp#L948