头 (放在脚本最前面. 必须!!!)
#Requires AutoHotkey v2.0
#SingleInstance Force
if not (A_IsAdmin)
{
try
{
if A_IsCompiled
Run '*RunAs "' A_ScriptFullPath '" /restart'
else
Run '*RunAs "' A_AhkPath '" /restart "' A_ScriptFullPath '"'
}
ExitApp
}
Win+L 锁屏拦截 (打工人必备)
锁屏前弹出弹窗,附带提醒信息,例如写日报和打卡 。。。
#L::
{
if A_Hour > 16 || (A_Hour == 16 && A_Min >= 30) {
Result := MsgBox("记得写日报和打卡!", "提醒!!!", "1")
if Result = "OK" {
RegWrite "0", "REG_DWORD", "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation"
DllCall("LockWorkStation")
Sleep(1000)
RegWrite "1", "REG_DWORD", "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation"
Sleep(1000)
SendMessage 0x0112, 0xF170, 2,, "Program Manager"
}
} else {
RegWrite "0", "REG_DWORD", "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation"
DllCall("LockWorkStation")
Sleep(1000)
RegWrite "1", "REG_DWORD", "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation"
}
}
alt+h/j/k/l 控制光标 左上下右 移动
!k::Send "{Up down}"
!j::Send "{Down down}"
!h::Send "{Left down}"
!l::Send "{Right down}"
ctrl+space 切换窗口最大化/最小化 (有bug)
^Space::
{
exeName := "alacritty.exe"
activeHwnd := WinGetID("A") ; 获取当前活动窗口
if WinExist("ahk_exe " exeName) {
; 如果已经是活动窗口则最小化,否则激活
if (WinActive("ahk_exe " exeName)) {
WinMinimize("ahk_exe " exeName)
} else {
if WinGetMinMax("ahk_exe " exeName) = -1
WinRestore
WinActivate
; 可选:置顶窗口
WinSetAlwaysOnTop(true, "ahk_exe " exeName)
}
} else {
Run(exeName)
; 等待窗口出现(最多2秒)
WinWait("ahk_exe " exeName,, 2)
WinSetAlwaysOnTop(true, "ahk_exe " exeName)
}
}
&spm=1001.2101.3001.5002&articleId=150578893&d=1&t=3&u=228b3b23a03440a49cef0b5be0c1ce8d)
311

被折叠的 条评论
为什么被折叠?



