Guest User

Google Chrome WhatsApp tab

a guest
Sep 28th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set urlMustContain to "web.whatsapp.com"
  2.  
  3. tell application "Google Chrome" to tell its window 1
  4.     activate
  5.     set tabExists to (tabs whose URL contains urlMustContain) exists
  6.     if tabExists then
  7.         set allTabs to every tab
  8.         set tabIndex to 1
  9.         repeat with i from 1 to count of allTabs
  10.             set thisTab to item i of allTabs
  11.             if URL of thisTab contains urlMustContain then
  12.                 set active tab index to tabIndex
  13.                 exit repeat
  14.             else
  15.                 set tabIndex to tabIndex + 1
  16.             end if
  17.         end repeat
  18.     else
  19.         return
  20.     end if
  21. end tell
Add Comment
Please, Sign In to add comment