Surface Pen button -> toggle Shift Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Kon 812

Surface Pen button -> toggle Shift  Topic is solved

12 Aug 2018, 17:54

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!
Alibaba
Posts: 473
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Surface Pen button -> toggle Shift

13 Aug 2018, 01:36

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
"Nothing is quieter than a loaded gun." - Heinrich Heine
Alibaba
Posts: 473
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: Surface Pen button -> toggle Shift

13 Aug 2018, 01:37

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
"Nothing is quieter than a loaded gun." - Heinrich Heine

Return to “Ask For Help”

Who is online

Users browsing this forum: TAC109 and 93 guests