Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. on alfred_script(q)
  2.  
  3. set _win to false
  4. tell application "Google Chrome"
  5. set {idList, urlList} to {id, URL} of every tab of every window
  6. end tell
  7.  
  8. set AppleScript's text item delimiters to return
  9.  
  10. if (urlList as text) contains "http://andrews-macbook-air-3.local:6006" = true then
  11. set theWin to 1
  12. repeat with i in urlList
  13. set theTab to 1
  14. repeat with n in i
  15. if n starts with "http://andrews-macbook-air-3.local:6006" then
  16. set {_win, _tab} to {theWin, theTab}
  17. end if
  18. set theTab to theTab + 1
  19. end repeat
  20. set theWin to theWin + 1
  21. end repeat
  22. end if
  23.  
  24. if _win ≠ false then
  25. tell application "Google Chrome"
  26. activate
  27. tell front window to set active tab index to _tab
  28. end tell
  29. else
  30. tell application "Google Chrome"
  31. set myTab to make new tab at beginning of tabs of window 1
  32. set URL of myTab to "http://andrews-macbook-air-3.local:6006/#agent"
  33. end tell
  34. end if
  35.  
  36. end alfred_script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement