Fiv*_*veO 2 windows autohotkey
我使用AutoHotKey 中的WinClose 脚本来关闭带有Ctrl+ w(^w) 的窗口。由于Ctrl+w有时已经是关闭窗口(或 Firefox 中的选项卡)的快捷方式,所以我再次发送一个Ctrl+ w,然后我猜它会以无限循环结束。我该如何解决?
这是错误消息:
这是我的脚本:
;;; make the “CTRL+W” key to close window or tab.
; which key to send depends on the application
^w::
IfWinActive ahk_class ATH_Note
{ ; ATH_Note is Windows Mail
; Ctrl+F4
Send !{F4}
}
IfWinActive ahk_class Notepad
{ ; Alt+F4
Send !{F4}
}
Else IfWinActive ahk_class Outlook Express Browser Class
{ WinMinimize, A
}
Else IfWinActive ahk_class IrfanView
{ Send {Esc}
}
Else ; IE, Firefox, Google Chrome, Opera
{ Send ^w
}
Return
Run Code Online (Sandbox Code Playgroud)
我会尝试使用上下文相关的热键,而不是检查按键上的活动窗口。您的其他热键仍然有效,但由于未指定您的浏览器,它们将保持其正常功能。我使用以下代码创建了您想要的功能:
#IfWinActive ahk_class ATH_Note
^w::Send !{F4}
#IfWinActive
#IfWinActive ahk_class Notepad
^w::Send !{F4}
#IfWinActive
#IfWinActive ahk_class Outlook Express Browser Class
^w::WinMinimize, A
#IfWinActive
#IfWinActive ahk_class IrfanView
^w::Esc
#IfWinActive
Run Code Online (Sandbox Code Playgroud)
如果程序之间有一些共享热键,您还可以创建组:
GroupAdd, FileExplorer, ahk_class EVERYTHING
GroupAdd, FileExplorer, ahk_class CabinetWClass
GroupAdd, FileExplorer, ahk_class #32770
#IfWinActive ahk_group FileExplorer
^w::WinMinimize, A
#IfWinActive
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6292 次 |
最近记录: |