- My following code is used for. When user is busy with outlook or other application and there is an incoming call to my Google chrome , tab number 20, how to bring the user quickly to that TAB.
to find Google chrome where and from the tab search for a specific TAB which is having a static title. Where my web-site apps were running.
Code: Select all
;
; Declare Title
;
chrome := "- Google Chrome"
found := "false"
tabSearch := "My webservice app"
curWinNum := 0
;
; Activate Application
;
SetTitleMatchMode, 2
WinGet, numOfChrome, Count, %chrome% ; Get the number of chrome windows
WinActivateBottom, %chrome% ; Activate the least recent window
WinWaitActive %chrome% ; Wait until the window is active
ControlFocus, Chrome_RenderWidgetHostHWND1 ; Set the focus to tab control ???
;
; Loop Application
;
while (curWinNum < numOfChrome and found = "false") {
WinGetTitle, firstTabTitle, A ; The initial tab title
title := firstTabTitle
Loop {
if(InStr(title, tabSearch)>0){
found := "true"
break
}
Send {Ctrl down}{Tab}{Ctrl up}
Sleep, 50
WinGetTitle, title, A ;get active window title
if(title = firstTabTitle){
break
}
}
WinActivateBottom, %chrome%
curWinNum := curWinNum + 1
}
; If we did not find it, start it
if(found = "false"){
Run "https://www.my-web-service-app.com/login"
}
return