I would suggest reading over the documentation on this... https://www.autohotkey.com/docs/v1/lib/IfExpression.htm Your 'if' and 'else' statements won't work on the same line.