AHK Across Script in Windows Holds Down the Button Even When Instructed to Release

丶灬走出姿态 提交于 2019-12-23 04:59:35

问题


I have a hotkey program in a different script that I am trying to trigger (#u::) and it seems to have a buggy behavior.

Script #1:

#MenuMaskKey vk07
#u::
msgbox,,test
return

Script # 2 that is trying to trigger the #u:: hotkey:

#SingleInstance
#NoEnv
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MenuMaskKey vk07
SendLevel, 10
Send, #{u} ; This successfully triggers the hotkey but now it holds down the # button

sleep, 1000
Send, {RWin Up} ;Here I am trying to release it but it still doesn't let it go

Btw, this occurs with all other modifiers, too like shift, alt, and control.

I am on the latest version (v1.1.26.01).


回答1:


Try this:

Script #1:

#InstallKeybdHook
#UseHook
#MenuMaskKey vk07

#u:: msgbox, test

Script # 2 that is trying to trigger the #u:: hotkey:

#SingleInstance
#NoEnv
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MenuMaskKey vk07

SendLevel 1
SendInput, {LWin down}u{LWin Up} 
If GetKeyState("LWin")
    Send {LWin Up} 
If GetKeyState("RWin")
    Send {RWin Up} 


来源:https://stackoverflow.com/questions/46408603/ahk-across-script-in-windows-holds-down-the-button-even-when-instructed-to-relea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!