Search code examples
variablesautohotkeyclipboardinvalid-characters

When assigning Clipboard I get the error "varible name contains an illegal character"


I'm trying to set the clipboard to a string but the string has characters causing the "varible name contains an illegal character" error. I'm not sure how I'm suppose to go about this error and I can't find any solutions.

My code:

var := "/text ~10 ~2 ~3 text:text"
Clipboard := %var%
Send, ^v

I expect it to paste "/text ~10 ~2 ~3 text:text" into a text editor, instead I get the error.


Solution

  • Variable names in an expression are not enclosed in percent signs.

    var := "/text ~10 ~2 ~3 text:text"
    Clipboard := var
    Send, ^v
    

    or

    Clipboard := "/text ~10 ~2 ~3 text:text"
    Send, ^v