好吧,我认为这是最终的脚本......
通常,除非您按 F6,否则所有键都照常运行,然后在 3 秒钟内您可以使用热键。一旦您使用热键,行为就会再次恢复正常(3 秒仅在您不按热键的情况下)。当您按两次 F6 时,它将发送 F6。如果您找到了更简单的解决方案,请告诉我,因为这相对复杂。
FormatTime, DateRef, %TimeNow%, yyyyMMdd ; Store current date in variable DateRef
MyLogFile = %A_ScriptDir%\LogFile-%DateRef%.txt ; Define the name of the log file for today.
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss
FileAppend, | %TimeAbsolute% | Your hotkey and possibly in which application`n`r,%MyLogFile% ; Write logfile
SpecialF6:=1
Suspend, On
Return
$F6::
Suspend, Permit
If SpecialF6
{
Suspend, Off
ToolTip Hotkeys On for 3 seconds,A_ScreenWidth/2-50,0
SpecialF6:=0
SetTimer, SuspendOn, 3000
Return
}
else
{
Send, {F6}
MyText = F6
Gosub, WriteClose
}
Return
SuspendOn:
Suspend, On
SetTimer, SuspendOn, Off
ToolTip
SpecialF6:=1
return
F5::
Run explorer
MyText = F5 Run Explorer
Gosub, WriteClose
Return
t::
Run notepad
MyText = t Run Notepad
Gosub, WriteClose
Return
!+5::
Run cmd
MyText = Alt Shift 5 Run Command
Gosub, WriteClose
return
WriteClose:
Suspend, On
SetTimer, SuspendOn, Off
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss
ToolTip
SpecialF6:=1
FileAppend, | %TimeAbsolute% | %MyText%`n`r,%MyLogFile% ; Write logfile
Exit