windows系统只有一个alt+tab键位来切换窗口,但是没有最小化最大化当前窗口的好用快捷键。自己做一个最大最小化快捷键来提高工作效率。
简易最大最小化脚本
使用autohotkeys V2.0版本自己做一个简单的窗口最大最小化快捷键脚本。
首先去autohotkeys官网下载软件,这个软件就是用来自定义快捷键来实现各种功能的脚本软件。
autohotkeys官网地址:https://www.autohotkey.com/
安装V2.0软件后,创建一个脚本(New script),在选择编辑脚本(edit script),写入下面代码并保存:
!Escape::WinMinimize "A" ;alt+Esc键最小化当前窗口,!代表alt键,Escape代表Esc键,A代表当前活动窗口
!`::WinMaximize "A" ;alt+`键最大化当前窗口
如果需要更深入了解或使用其他组合键,参考:
autohotkeys使用手册:https://wyagd001.github.io/v2/docs/index.htm
然后把这个脚本文件保存到启动项内,目的是保证每次开机都能自启动该脚本。
也就是把脚本放到C:\Users\用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
这个文件夹目录下,就实现开机自启动了!
最大最小化优化脚本
其实还可以优化一下脚本:
alt
+`键设置成最大或还原窗口功能
!Escape::WinMinimize "A" ;alt+Esc键最小化当前窗口,!代表alt键,Escape代表Esc键,A代表当前活动窗口
!`:: ;alt+`键最大化或还原当前窗口
{
if WinGetMinMax("A") ;如果当前活动窗口为最大化状态
WinRestore "A" ;则恢复当前窗口
else
WinMaximize "A" ;否则最大化当前窗口
}
添加窗口拖动快捷键
还可以添加一个CapsLock
键+鼠标左键实现拖动窗口:
在代码最后一行添加:
~MButton & LButton::
CapsLock & LButton::
EWD_MoveWindow(*)
{
CoordMode "Mouse" ; Switch to screen/absolute coordinates.
MouseGetPos &EWD_MouseStartX, &EWD_MouseStartY, &EWD_MouseWin
WinGetPos &EWD_OriginalPosX, &EWD_OriginalPosY,,, EWD_MouseWin
if !WinGetMinMax(EWD_MouseWin) ; Only if the window isn't maximized
SetTimer EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
EWD_WatchMouse()
{
if !GetKeyState("LButton", "P") ; Button has been released, so drag is complete.
{
SetTimer , 0
return
}
if GetKeyState("Escape", "P") ; Escape has been pressed, so drag is cancelled.
{
SetTimer , 0
WinMove EWD_OriginalPosX, EWD_OriginalPosY,,, EWD_MouseWin
return
}
; Otherwise, reposition the window to match the change in mouse coordinates
; caused by the user having dragged the mouse:
CoordMode "Mouse"
MouseGetPos &EWD_MouseX, &EWD_MouseY
WinGetPos &EWD_WinX, &EWD_WinY,,, EWD_MouseWin
SetWinDelay -1 ; Makes the below move faster/smoother.
WinMove EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY,,, EWD_MouseWin
EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine.
EWD_MouseStartY := EWD_MouseY
}
}
autohotkeys官网使用说明里面有很多脚本展示,https://wyagd001.github.io/v2/docs/scripts/index.htm
从这里面找到自己想要的复制下来就好了。