Page 1 of 1

AHK_H v2 - Double quotes in arguments

Posted: 14 Aug 2016, 11:45
by golpebaixo_
So in AHKv2 double quotes are completely removed from strings passed as arguments.
Single quotes can be escaped but not double quotes.

There's a weird issue however. If we add a escaped grave (`) to the beginning of the string all the double quotes will pass through but it works only for the first argument.

If we try the following

Code: Select all

newThread := '
(
	MsgBox(A_Args[1] . " " . A_Args[2])
)'

ExeThread(newThread, '``"STRING1" ``"STRING2"')
Sleep 3000
We get

Image

Which part of that is a bug?
Shouldn't AHK just accept escaped double quotes in arguments as well, just like it accepts single quotes?

Re: AHKv2 - Double quotes in arguments

Posted: 15 Aug 2016, 18:51
by HotKeyIt
That is how CommandLineToArgvW converts the parameters, the first are left because it is assumed to be the executable.
To keep quotes you have to pass 3 of them:

Code: Select all

 newThread := '
(
	MsgBox(A_Args[1] . " " . A_Args[2])
)'
 
ExeThread(newThread, '``"STRING1" ``"""STRING2"""')
Sleep 3000

Re: AHKv2 - Double quotes in arguments

Posted: 15 Aug 2016, 19:40
by lexikos
I suppose that the problem is specific to ExeThread, and really has nothing to do with AHKv2.

Re: AHKv2 - Double quotes in arguments

Posted: 16 Aug 2016, 02:08
by golpebaixo_
Oh nice, adding 3 of them works fine.
Thanks,

Re: AHKv2 - Double quotes in arguments

Posted: 16 Aug 2016, 17:13
by HotKeyIt
lexikos wrote:I suppose that the problem is specific to ExeThread, and really has nothing to do with AHKv2.
ExeThread is only available for AHK_H v2 hence the post in the v2 forum, I have moved the topic to ask for help.