StringSplit is chopping off a character

Posted on

QUESTION :

I have a hotkey setup like this:

Numpad1::
ClipSave := ClipboardAll
Send, ^+{Left}^+{Left}
Send ^x
StringSplit, Commands, Clipboard, {Space}
Send, local{Space}
Send, %Commands1%
Send, {Space}={Space}
Send, %Commands2%
Return

Given the input lua 1, it should produce local lua = 1. But, it produces Local lu = 1. Why and how can i fix it?

ANSWER :

Use %A_Space% rather than {Space}

Numpad1::
ClipSave := ClipboardAll
Send, ^+{Left}^+{Left}
Send ^x
StringSplit, Commands, Clipboard, %A_Space%
Send, local{Space}
Send, %Commands1%
Send, {Space}={Space}
Send, %Commands2%
Return

produces local lua = 1 from lua 1 over here, wheras {Space} gives lu, as you experienced 🙂

Leave a Reply

Your email address will not be published.