I like to switch to a running chrome session by e.g. pressing "ooo" (like the calc example).
If chrome already is running, I like to switch to it at the present tab-folder.
If chrome is closed - simply this shortcut should start chrome.
In the moment I don't have a good idea.
normally in a batch I would check the running tasks.
How is it possible by ahk?
br - thomas
"switch" to google chrome instead of start 2nd instance
I use something like this...
This script does a little bit more than you asked for.
I use it for every application that I start frequently.
If the app is not already started => it starts the app.
If the app is started but doesn't have the focus => brings the app to the foreground.
If the app has the focus and there are more than one window of this app => it cycles through the open windows.
If the app has the focus (only one window) => it minimises the app.
Code: Select all
THEapp:="Total Commander"
IfWinExist, %THEapp%
IfWinNotActive
WinActivate
else {
WinGet, numCountWindows, Count, %THEapp%
if (numCountWindows>1) { ;more than one open window -> cycle
WinGetClass, ActiveClass, A
WinSet, Bottom,, A
WinActivate, ahk_class %ActiveClass%
}
else {
WinMinimize
}
}
else {
run C:\...\TOTALCMD.EXE
}
I use it for every application that I start frequently.
If the app is not already started => it starts the app.
If the app is started but doesn't have the focus => brings the app to the foreground.
If the app has the focus and there are more than one window of this app => it cycles through the open windows.
If the app has the focus (only one window) => it minimises the app.
This works for me:
String: ooo
Type: Command
Substitute:
You may need to adapt the Chrome path to your Windows version.
String: ooo
Type: Command
Substitute:
Code: Select all
IfWinNotExist ahk_exe chrome.exe
run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
WinWait, ahk_exe chrome.exe
WinActivate, ahk_exe chrome.exe
Thanks, I can use this.ChrisKey wrote:
I use something like this...
This script does a little bit more than you asked for.Code: Select all
THEapp:="Total Commander" IfWinExist, %THEapp% IfWinNotActive WinActivate else { WinGet, numCountWindows, Count, %THEapp% if (numCountWindows>1) { ;more than one open window -> cycle WinGetClass, ActiveClass, A WinSet, Bottom,, A WinActivate, ahk_class %ActiveClass% } else { WinMinimize } } else { run C:\...\TOTALCMD.EXE }
I use it for every applikation that I start frequently.
If the app is not already started => it starts the app.
If the app is started but doesn't have the focus => brings the app to the foreground.
If the app has the focus and there are more than one window of this app => it cycles through the open windows.
If the app has the focus (only one window) => it minimises the app.