1. Look at existing Chrome sessions and see if I already have an open page matching part or all of a title?
2. Look at existing Chrome sessions and see if I already have an open page matching part or all of a url?
3. Activate Chrome and jump to either of 1 or 2 above if found?
4. Open a page and wait for it to complete loading before doing something with it?
For 1, 2 and 3 I don't even know where to start (and as before, not had any luck with googling and using libraries).
For 4, I did the below, but it breaks a lot as I can't reliably say when the page has finished loading... (I can only use WinWaitActive for the application, and cannot test the tab inside there unless someone has a nice bit of code for this?).
Code: Select all
Open_Chrome(url)
{
Sleep 200
if WinExist("ahk_exe Chrome.exe") ; or WinExist("ahk_class" . ClassName)
{
WinActivate ahk_exe chrome.exe
WinWaitActive ahk_exe chrome.exe ; Activates the last found and open a new tab
Send ^l ; Ctrl-l to activate address bar
Sleep 100
Send ^t ; Ctrl-t to open a new tab
Sleep 100
Send ^l ; Ctrl-l to activate address bar
Sleep 100
Send %url%{Enter}
Sleep 100
}
else
{
Run % "chrome.exe --new-tab" url
WinActivate ahk_exe chrome.exe
WinWaitActive ahk_exe chrome.exe ; Activates the last found and open a new tab
Sleep 100
Send ^l ; Ctrl-l to activate address bar
Sleep 100
}
}