So I am trying to create a shortcut that will allow me to open a specific website in a new tab, when chrome is already open. To start I was trying to open a new tab in chrome. I got a script to work that opens a new window of chrome with a blank tab, but I want it to be in a window that is already there. This is my working script:
This code looks like it should work, but I keep getting an error about line 2
"Error at line 2.
Line Text: WinExist, ahk_class chrome.exe
This line does not contain a recognized action.
The program will exit."
Help? lol. Not sure where to go from here. Thanks!
[Mod edit: Moved topic from AHK v2 help since this v1 code.]
CODE:
; Open new Chrome tab (Win+Alt+C)
;^+C::
; Run, C:\Program Files\Google\Chrome\Application\chrome.exe --new-tab
;return
This code looks like it should work, but I keep getting an error about line 2
"Error at line 2.
Line Text: WinExist, ahk_class chrome.exe
This line does not contain a recognized action.
The program will exit."
CODE:
^+C::
WinExist, ahk_class chrome.exe, ; Check if Chrome is running (by class name)
IfWinExist, ahk_class chrome.exe {
WinActivate, ahk_class chrome.exe ; Switch focus to existing Chrome
Sleep, 100 ; Optional: Short delay to ensure Chrome activation (adjust if needed)
Run, chrome.exe --new-tab ; Open new tab in activated Chrome
}
return
Help? lol. Not sure where to go from here. Thanks!
[Mod edit: Moved topic from AHK v2 help since this v1 code.]
Statistics: Posted by Tweva33 — Today, 13:21