AutoHotkey: how to restart the script when the ctrl control key is stuck

Post your working scripts, libraries and tools
partof
Posts: 94
Joined: 16 Jan 2016, 08:38

AutoHotkey: how to restart the script when the ctrl control key is stuck

03 Mar 2019, 01:07

Code: Select all

^ESC:: ; so you can reload when the ctrl key is stuck by just pressing escape
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
; MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
; IfMsgBox, Yes, Edit
return
aifritz
Posts: 107
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: AutoHotkey: how to restart the script when the ctrl control key is stuck

03 Mar 2019, 11:26

This code works for me quite good:
It checks the left and right Ctrl key and releases it, if key was down

Code: Select all

      GetKeyState,stateL,LCtrl
      GetKeyState,stateP,LCtrl, P
      if (stateL <> stateP)
         Send,{LCtrl Up}

      GetKeyState,stateL,RCtrl
      GetKeyState,stateP,RCtrl, P
      if (stateL <> stateP)
         Send,{RCtrl Up}


Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 36 guests