Help with objects and error message
Posted: 16 Apr 2021, 17:10
Sorry for the generic title. I have the following hotkey:
The intended semantics are: when the user presses alt gr + shift + -, record one input Char. If MacronKeys contains that char, output the corresponding letter (for Space, ¯, for a, ā). If it doesn't, simply send ¯ and append the input char to it.
What actually happens:
If I press the hotkey and then "a", nothing is sent.
If I press space, I get an error: and then the line of Send above.
If I press anything that isn't in MacronKeys, nothing is sent.
This is my first time making a complex script, so I'm probably messing up something basic (and I tried various combinations of % signs around variables and whatnot), but I couldn't figure out why even searching through the documentation. Help?
Code: Select all
MacronKeys := {Space: ¯, a: ā} ; this is declared at the top of the script
; ...
; Alt Gr + Shift + -
<^>!+-::
Input, Char, L1
Send % (MacronKeys.HasKey(%Char%)? MacronKeys[%Char%] : ¯%Char%)
return
; ...
What actually happens:
If I press the hotkey and then "a", nothing is sent.
If I press space, I get an error:
Code: Select all
The following variable name contains an illegal character: " "
If I press anything that isn't in MacronKeys, nothing is sent.
This is my first time making a complex script, so I'm probably messing up something basic (and I tried various combinations of % signs around variables and whatnot), but I couldn't figure out why even searching through the documentation. Help?