F2:: ; Close all windows (open/minimized, browsers) but not pwr off WinGet, id, list,,, Program Manager Loop, %id% { this_id := id%A_Index% WinActivate, ahk_id %this_id% WinGetClass, this_class, ahk_id %this_id% WinGetTitle, this_title, ahk_id %this_id% If(This_class != "Shell_traywnd") && (This_class != "Button") ; If class is not Shell_traywnd and not Button WinClose, ahk_id %this_id% ;This is what it should be ;MsgBox, This ahk_id %this_id% ; Easier to test ;) } Return
If you don’t know or can’t find the executable for the program you wish to AHK to you can place a link on the desktop or somewhere else and trigger the link using a mapped key as follows;
F3:: ;Open QGIS path = "C:\Users\brooks.mark\Desktop\QGIS Desktop 2.14.8.lnk" ;MsgBox, %path% Run, %path% Return
Open Chrome using CTRL Z – (^ is the sign for CTRL)
^z:: Run, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe Return
Here I have a key to open a work Uniform program – line send types into the username field usernamevariable – alter to your actual value
F6:: path = "C:\Users\brooks.mark\Desktop\Uniform LIVE.lnk" ;MsgBox, %path% Run, %path% Sleep, 5000 ControlFocus, Edit4,Uniform Spatial - LIVE Database Send, usernamevariable Return