Conditional Open App
How do I make it so that if I hit F11 it will open Chrome, BUT if Chrome is already open it will just make it pop up and be the active window? Thanks!
Shortcut: F11
Type: Command
Type: Command
Code: Select all
If Not WinExist("ahk_exe chrome.exe")
Run, chrome.exe
Else
WinActivate, ahk_exe chrome.exe
That works great. I tried to run the same script for Outlook (using F10):
If Not WinExist("ahk_exe outlook.exe")
Run, outlook.exe
Else
WinActivate, ahk_exe outlook.exe
BUT it still opens a new instance of Outlook everytime I hit F10. What did I do wrong?
If Not WinExist("ahk_exe outlook.exe")
Run, outlook.exe
Else
WinActivate, ahk_exe outlook.exe
BUT it still opens a new instance of Outlook everytime I hit F10. What did I do wrong?
Code: Select all
If Not WinExist("Inbox - Outlook")
Run, outlook.exe
Else
WinActivate, Inbox - Outlook
That still creates a new instance of Outlook when I run it.
Then adjust the code with your window name (use Tools/Window information tool).
I am very sorry, but I don't understand what you mean.
No problem. Open the Windows Information tool from Tools/Window information menu. Then move the mouse to your open main Outlook window. Read the information from the tool. Replace the "Inbox - Outlook" parts in the code with a window text name.
You can also post or send us a screenshot of the Window information.
You can also post or send us a screenshot of the Window information.