Page 1 of 1

Only run script if specific Chrome tab is active

Posted: 02 Aug 2020, 12:56
by BIGZIPZ
Let’s say I have this basic piece of code just as an example. How do I make it only run if a specific Chrome tab is active. Let’s assume the windows spy tool says the tab is called “test”. Here is the simple code:

F10::
Send {LAlt down}{Tab}{LAlt up}
return


Thanks

Re: Only run script if specific Chrome tab is active

Posted: 02 Aug 2020, 13:09
by garry
an example

Code: Select all

#warn
#noenv
#Singleinstance,force
f1:="https://www.channelnewsasia.com/news/international"
Detecthiddenwindows,on ;- if windows hidden 
settitlematchmode,2     ;- a part from wintitle
aa:="Breaking news"     ;- here a part from WinTitle
IfWinNotExist,%aa%      ;- first run url F1 when start this script , if WinTitle not exist
  run,%f1%
return
esc::exitapp


~$F10::
If (WinExist(aa))   ;- activate if minimized
  {
  WinActivate
  winwaitactive
  ;- do something here ---------
  sleep,300
  ;Send {LAlt down}{Tab}{LAlt up}
  ;-----------------------------
  ;--- copy title ---------
  WinGetActiveTitle, title
  msgbox, 262208,TEST ,Title=`n%title%
  }
else 
  msgbox, 262208, , WinTitle not exist: %aa%
;clipboard=
return
;==================================================