#Requires AutoHotkey v2.0 #SingleInstance Force ; --- 应用程序管理 --- ; Win + Z: 管理 Notion 窗口 #z:: { if WinExist("ahk_exe Notion.exe") { if WinActive("ahk_exe Notion.exe") { WinMinimize ; 隐藏 Notion 窗口 } else { WinActivate ; 激活 Notion 窗口 } } else { try { Run "explorer.exe shell:AppsFolder\com.notion.app.desktop.notion_87smfmv0eebam!com.notion.app.desktop.notion" ; 启动商店版 Notion } catch { MsgBox "错误:无法启动 Notion,请检查文件路径。" } } } ; Win + C: 管理 VS Code 窗口 #c:: { if WinExist("ahk_exe Code.exe") { if WinActive("ahk_exe Code.exe") { WinMinimize ; 隐藏 VS Code 窗口 } else { WinActivate ; 激活 VS Code 窗口 } } else { try { Run "D:\Program Files\Microsoft VS Code\Code.exe" ; 启动 VS Code } catch { MsgBox "错误:无法启动 VS Code,请检查文件路径。" } } } ; Win + T: 管理 Windows 终端窗口 #t:: { if WinExist("ahk_exe WindowsTerminal.exe") { if WinActive("ahk_exe WindowsTerminal.exe") { WinMinimize ; 隐藏 Windows 终端窗口 } else { WinActivate ; 激活 Windows 终端窗口 } } else { try { Run "wt.exe" ; 启动 Windows 终端 } catch { MsgBox "错误:无法启动 Windows 终端,请确保 wt.exe 在 PATH 中。" } } } ; Win + X: 管理 Cursor 窗口 #x:: { if WinExist("ahk_exe Cursor.exe") { if WinActive("ahk_exe Cursor.exe") { WinMinimize ; 隐藏 Cursor 窗口 } else { WinActivate ; 激活 Cursor 窗口 } } else { try { Run "D:\Program Files\cursor\Cursor.exe" ; 启动 Cursor } catch { MsgBox "错误:无法启动 Cursor,请检查文件路径。" } } } ; Win + S: 管理 Google Chrome 窗口 #s:: { if WinExist("ahk_exe chrome.exe") { if WinActive("ahk_exe chrome.exe") { WinMinimize ; 隐藏 Chrome 窗口 } else { WinActivate ; 激活 Chrome 窗口 } } else { try { Run "C:\Program Files\Google\Chrome\Application\chrome.exe" ; 启动 Chrome } catch { MsgBox "错误:无法启动 Google Chrome,请检查文件路径。" } } } ; Win + A: 管理chatgpt 窗口 #a:: { if WinExist("ahk_exe ChatGPT.exe") { if WinActive("ahk_exe ChatGPT.exe") { WinMinimize ; 隐藏 chatgpt 窗口 } else { WinActivate ; 激活 chatgpt 窗口 } } else { try { Run "explorer.exe shell:AppsFolder\OpenAI.Codex_2p2nqsd0c76g0!App" ; 使用系统注册的入口启动 ChatGPT } catch { MsgBox "错误:无法启动 chatgpt,请检查文件路径。" } } } ; --- 窗口管理 --- ; Win + F: 切换窗口最大化/恢复 #f:: { WinState := WinGetMinMax("A") if (WinState = 1) WinRestore("A") ; 恢复窗口 else WinMaximize("A") ; 最大化窗口 } ; Win + W:通过微信内置快捷键唤起 / 最小化当前微信 #w:: { DetectHiddenWindows false SetTitleMatchMode 3 hwnd := WinExist("微信 ahk_exe Weixin.exe") if hwnd && WinActive(hwnd) { WinMinimize hwnd return } if ProcessExist("Weixin.exe") { ; 等待物理按键松开,避免 Win 键混入 Ctrl + Alt + W KeyWait "w" KeyWait "LWin" KeyWait "RWin" ; 使用已在本机验证的微信“打开微信”快捷键 ; 由微信自身恢复窗口及交互状态 Send "^!w" if !WinWait("微信 ahk_exe Weixin.exe", , 3) MsgBox "微信未能显示,请确认微信设置中的“打开微信”快捷键为 Ctrl + Alt + W。" } else { try { Run "C:\Program Files\Tencent\Weixin\Weixin.exe" } catch { MsgBox "错误:无法启动微信,请检查安装路径。" } } } ; Win + Q:显示 / 最小化 Visual Studio 2022 专业版 #q:: { hwnd := WinExist("ahk_exe devenv.exe") if hwnd { if WinActive(hwnd) { WinMinimize hwnd } else { if WinGetMinMax(hwnd) = -1 WinRestore hwnd WinActivate hwnd } } else { try { Run "D:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe" } catch { MsgBox "错误:无法启动 Visual Studio 2022,请检查安装路径。" } } } ; Win + H: 最小化活动窗口 #h:: WinMinimize "A"