【发布时间】:2017-05-02 16:05:23
【问题描述】:
谁能解释一下,为什么我会收到“错误”消息框?
我认为,代码是不言自明的。当我发现它由于某种原因不起作用时,我感到“惊讶”。
(当您在打开的记事本窗口中按 F1 时,您应该会看到“It works!”消息。相反,我收到“Error”消息)。
我尝试了不同的方法来修复它,即百分比、变量赋值、括号,但目前它仍然不起作用。
#SingleInstance, Force
SetTitleMatchMode, 2
f1::
+f1::
GetKeyState, shift_state, Shift
msgbox, %shift_state%
if (WinActive("Notepad") and shift_state = D)
msgbox, It works! By the way, the Shift key is pressed.
else if (WinActive("Notepad") and shift_state = U)
msgbox, It works! The Shift key is not pressed.
else
msgbox, error
return
【问题讨论】:
标签: autohotkey