我升级了键盘。问题是现在所有的脚本都停止了工作。即使是教程中的简单脚本也无法正常工作。
这种情况发生在所有应用程序中,如果我插入旧键盘并重新启动计算机,即使在我以前的配置中,autohotkey也不再起作用。我也尝试过以管理员模式运行。
然而,我所看到的是,每次重新启动autohotkey时脚本只能运行一次。例如:
^j::
Send, My First Script
Return
这是第一次按下ctrl-j时有效,但是在我重新启动autohotkey之后它再次无效。
有什么想法吗?我有Windows 10 x64,1.1.23.05。我没有使用新键盘安装任何新的驱动程序(它是一个标准的USB键盘,虽然是机械类型)。
以下是一些不起作用的简单脚本的例子:
SetCapslockState AlwaysOff
在这种情况下,我第一次按下大写字母时,它确实被忽略了,但是下次我点击它时会正常工作。
a::return
同样,相同的行为:a第一次被忽略,但下次它正常工作,直到我重新启动AHK(然后再次只能在第一次工作)。
请注意,在所有情况下,我只使用您看到的单行脚本运行AHK;没别的。
下面是按Ctrl-J(第一个示例)
时的键历史和最后一行Window: C:\Files\Tools\AutoHotKey\1.ahk - AutoHotkey v1.1.23.05
Keybd hook: yes
Mouse hook: no
Enabled Timers: 0 of 0 ()
Interrupted threads: 0
Paused threads: 0 of 0 (0 layers)
Modifiers (GetKeyState() now) =
Modifiers (Hook's Logical) =
Modifiers (Hook's Physical) =
Prefix key is down: no
NOTE: To disable the key history shown below, add the line "#KeyHistory 0" anywhere in the script. The same method can be used to change the size of the history buffer. For example: #KeyHistory 100 (Default is 40, Max is 500)
The oldest are listed first. VK=Virtual Key, SC=Scan Code, Elapsed=Seconds since the previous event. Types: h=Hook Hotkey, s=Suppressed (blocked), i=Ignored because it was generated by an AHK script, a=Artificial, #=Disabled via #IfWinActive/Exist, U=Unicode character (SendInput).
VK SC Type Up/Dn Elapsed Key Window
-------------------------------------------------------------------------------------------------------------
74 03F d 11.94 F5 C:\Files\Tools\AutoHotKey\1.ahk - AutoHotkey v1.1.23.05
A2 01D d 3.09 LControl *c:\Files\Tools\AutoHotKey\1.ahk - Notepad++
74 03F d 1.99 F5 C:\Files\Tools\AutoHotKey\1.ahk - AutoHotkey v1.1.23.05
Press [F5] to refresh.
行
001: Return (15.77)
003: if ( GetKeyState( "Control" , "P" ) )
007: Return (150.50)