Page 1 of 1

Surface Pen button -> toggle Shift

Posted: 12 Aug 2018, 17:54
by Kon 812
I'm trying to piece together a script that toggles Shift on and off (up and down) when the button at the end of a Surface Pen is pressed.

My current script is as follows:

#F20::
Sleep, 100
Send, {Shift down}
KeyWait, #F20
Send, {Shift up}
return

It throws an invalid parameter error at the fourth line. Removing the space did nothing.
If it's relevant, the first line threw the same error with a space in, or seemed to.

Please contribute any insight into a solution or the nature of these Pen keys that you may have. It will be greatly appreciated. Thanks!

Re: Surface Pen button -> toggle Shift

Posted: 13 Aug 2018, 01:36
by Alibaba
You can use a toggle variable.

Code: Select all

toggleShift := false
;variable must be set in auto execution section! (At the top of the script)

#F20::
Sleep, 100
if !toggleShift
   Send, {Shift down}
else
   Send, {Shift up}
toggleShift := !toggleShift
return

Re: Surface Pen button -> toggle Shift

Posted: 13 Aug 2018, 01:37
by Alibaba
Please don’t open multiple topics with the same question. If you are posting as a guest you will have to wait for the topic approval and duplicating topics will only result in extra work for the moderation team, but not in a faster approval.
The time it takes the moderation team to check posts is depending on the current activity, so there are no guarantees. Consider registering an account. Once your account is approved you can post topics without waiting time.

Greetings,
Alibaba