Only run script if specific Chrome tab is active

Get help with using AutoHotkey and its commands and hotkeys
BIGZIPZ
Posts: 2
Joined: 02 Aug 2020, 12:49

Only run script if specific Chrome tab is active

02 Aug 2020, 12:56

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
garry
Posts: 2397
Joined: 22 Dec 2013, 12:50

Re: Only run script if specific Chrome tab is active

02 Aug 2020, 13:09

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
;==================================================

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, mikeyww, PlumpSamurai, RubbeH, Stewn and 38 guests