Keys stop working often.

Report problems with documented functionality
xdaimon
Posts: 1
Joined: 01 Nov 2017, 11:00

Keys stop working often.

Post by xdaimon » 01 Nov 2017, 11:23

Sometimes key mappings stop working. Idk how this happens, but it happens often.
Also, it seems that win+L cannot be mapped to anything since windows will always intercepts it.
In general it's frustrating that Windows is able to intercept my key mappings. For example if the taskmanager is the focused window, then all of my autohotkey bindings stop working :thumbdown: .

Here is my script. I'm using windows 10.

Code: Select all

#SingleInstance force

;; 								change window focus
!k::!Esc
!j::!+Esc

;; 								switch between multiple desktops
!h::
	Send {LCtrl down}{LWin down}{Left down}{Left up}{LWin up}{LCtrl up}
return
!l::
	Send {LCtrl down}{LWin down}{Right down}{Right up}{LWin up}{LCtrl up}
return
!Left::
	Send {LCtrl down}{LWin down}{Left down}{Left up}{LWin up}{LCtrl up}
return
!Right::
	Send {LCtrl down}{LWin down}{Right down}{Right up}{LWin up}{LCtrl up}
return

;; 								another way to open the start menu
!Space::
	Send ^{Esc}
return

;; 								kill window
+!d::
	Send !{F4}
return

;; 								maximize window
!f::
	Send {LWin down}{Up down}{Up up}{LWin up}
return

;; 								start menu movements
#IfWinActive ahk_class Windows.UI.Core.CoreWindow
^j::
	Send {Down}
return
^k::
	Send {Up}
return
#IfWinActive

;; 								context menu movements
#IfWinActive ahk_class Progman
^j::
	Send {Down}
return
^k::
	Send {Up}
return
#IfWinActive

;; 								window tile view movements
#IfWinActive ahk_class MultitaskingViewFrame
^j::
	Send {Down}
return
^k::
	Send {Up}
return
^l::
	Send {Right}
return
^h::
	Send {Left}
return
#IfWinActive

;; 									launch cmd
!Enter::
	Run C:\Windows\System32\cmd.exe /K "cd C:\Users\gazin\Programming & bash"
return

;; 								        tile windows
#l::
	Send {LWin down}{Right down}{Right up}{LWin up}
return
#h::
	Send {LWin down}{Left down}{Left up}{LWin up}
return

;; 									sound vol
!Up::
	Send {Volume_Up}
return
!Down::
	Send {Volume_Down}
return
!m::
	Send {Volume_Mute}
return

User avatar
Exaskryz
Posts: 2873
Joined: 17 Oct 2015, 20:28

Re: Keys stop working often.

Post by Exaskryz » 04 Nov 2017, 09:13

Win+L is protected by Windows, yes. I don't recall if someone has come around with workarounds, but there are few protected keybinds that AHK wouldn't be able to use.

As for why it doesn't work in Task Manager, it is probably because Task Manager was launched with admin or elevated privileges. I would not expect this to to stop you from using commands like WinActivate to change focus, but I would expect Send or Click commands on the Task Manager would fail. I think you should be able to bypass this by running your script as an administrator. However, be careful about changes to your script that can make it erratic, like long strings of characters that you Send. If your computer is a bit slow, it can result in opening menus unexpectedly and make changes to your system that otherwise wouldn't've been made if you didn't have admin rights. (Any damage a rogue AHK script does without admin rights shouldn't be too severe and readily undoable.)
User avatar
jeeswg
Posts: 5117
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Keys stop working often.

Post by jeeswg » 04 Nov 2017, 12:43

This might be useful re. Win+L:
Wanna override Win + L? - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/9573 ... ntry638771

The script might need to be run in Admin mode.
Post Reply

Return to “Bug Reports”