Monday, November 6, 2017

windows 7 - Autohotkey script making keys "sticky"



I've been successfully using an AHK script for almost a year which maps Ctrl-C and Alt-E-S-V (an Excel shortcut) to Win-key combinations, and maps Ctrl-Del to Ctrl-Space, Ctrl-- (delete row).



However, occasionally (and more and more frequently), the computer thinks that the Win or Ctrl key is still held down. I've spent a long time looking for a fix and nothing has worked for me, including various script rewrites and uninstalling and reinstalling AHK.




Here's my script:



#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

;map ctrl-c, ctrl-v, and ctrl-e-s-v (paste values) to win-key combos
#a::Send ^c
#s::Send ^v

#q::Send !e,{s},{v}{Enter}

*CapsLock::Send {Media_Play_Pause}
Return ;disable CapsLock permanently

;map win-x to ctrl-alt-/ - shortcut to open 'everything.exe', then close it automatically when it's not in focus
#x::
Send ^!/
Sleep, 1000
WinWaitNotActive, ahk_class EVERYTHING

WinClose, ahk_class EVERYTHING
return

;win-z to prt scn
#z::Send {PrintScreen}

;map ctrl-del to select whole line and delete it
~^Del::
Send +{space}
Send ^-

Send {Left}
return


Edit: this person had the same problem as me, though none of the fixes suggested in that thread helped me.


Answer



No telling if this will fix the problem, but you can try this script.



; Always run your script as admin
if not A_IsAdmin

{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
SetKeyDelay, 50

;There's a command for disabling CapsLock permanently

SetCapsLockState, AlwaysOff

return

$#a::^c
$#s::^v
$#z::PrintScreen
$#q::SendEvent, ^!v!v{Enter}
$#x::
Send ^!/

Sleep, 1000
WinWaitNotActive, ahk_class EVERYTHING
WinClose, ahk_class EVERYTHING
return

$~^Del::SendEvent, +{space}^-{Left}


Tested all the rempas (except win+x) and they seem to be working just fine. I haven't been able to duplicate the modifier problem you're having.




Let me know if this solved hte problem. If not, we can try to adjust fire.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...