[英]How can I show/hide a window with a hotkey?
I'm looking for a way to show/hide a window with a specific title. 我正在寻找一种显示/隐藏具有特定标题的窗口的方法。 One example is when you press win+1
, the first window at task bar will show, when you press again, it will be minimized. 一个示例是,当您按下win+1
,将显示任务栏上的第一个窗口,再次按下时,它将最小化。
I checked this page , but the methods they suggested are not working at my end. 我检查了此页面 ,但是他们建议的方法最后没有用。
You check whether a specific window has been minimized with WinGet . 您检查WinGet是否已将特定窗口最小化。 ( Credit to Laszlo ) ( 感谢Laszlo )
WinGet WinState, MinMax, %WinTitle% ; Retrieve minimized/maximized state
You can then show or hide said window with WinMinimize and WinRestore . 然后,您可以使用WinMinimize和WinRestore显示或隐藏所说的窗口。
#m::WinMinimize, Untitled - Notepad ; Minimize window to taskbar
#r::WinRestore, Untitled - Notepad ; Unminimize or unmaximize window
The hotkey below checks a window's state, then minimizes or unminimizes the window. 下面的热键检查窗口的状态,然后最小化或最小化窗口。
#1::
WinTitle := "Untitled - Notepad"
WinGet WinState, MinMax, %WinTitle% ; retrieve minimized/maximized state
if (WinState = -1) ; minimized
WinRestore, %WinTitle%
else ; not minimized
WinMinimize, %WinTitle%
Return
See Also 也可以看看
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.