Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- #Warn All
- #WinActivateForce
- EnvGet A_LocalAppData, LocalAppData
- EnvGet A_ProgramFilesX86, ProgramFiles(x86)
- return ; End of auto-execute
- 1::SwitchOrRun("- Word", "WINWORD.EXE")
- 2::MinimizeAll("WINWORD.EXE")
- 3::SwitchOrRun("- Google Chrome", "chrome.exe")
- 4::MinimizeAll("chrome.exe")
- 5::SwitchOrRun("- Visual Studio Code", A_LocalAppData "\Programs\Microsoft VS Code\Code.exe")
- 6::MinimizeAll("code.exe")
- 7::SwitchOrRun("Mendeley Desktop", A_ProgramFilesX86 "\Mendeley Desktop\MendeleyDesktop.exe")
- 8::MinimizeAll("MendeleyDesktop.exe")
- ; Functions
- MinimizeAll(ExeName)
- {
- DetectHiddenWindows Off
- WinGet wList, List, % "ahk_exe " ExeName
- loop % wList
- WinMinimize % "ahk_id " wList%A_Index%
- }
- SwitchOrRun(WinTitle, Path)
- {
- SetTitleMatchMode 2
- SplitPath Path, ExeName
- if !WinExist(WinTitle " ahk_exe " ExeName) {
- Run % Path,, UseErrorLevel
- if (ErrorLevel) {
- MsgBox 0x10, Error, % "Path not found: " Path
- return
- }
- }
- WinActivate % WinTitle
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement