Guest User

Untitled

a guest
May 6th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. -----------------------------------------------------
  2. # Handler: Open Safari and minimize the window
  3. -----------------------------------------------------
  4. on theSafari(theURL)
  5. open location (theURL)
  6. delay 4 --- Because audio may not load unless you let it
  7. tell application "Safari"
  8. set miniaturized of window 1 to true
  9. end tell
  10. end theSafari
  11.  
  12.  
  13. -----------------------------------------------------
  14. # Close windows of certain domain, but only if Safari is running
  15. -----------------------------------------------------
  16. set tabURL to "google.com" --- Just a sample domain
  17. tell application "Safari"
  18. if it is running then
  19. set windowlist to windows
  20. repeat with i in windowlist
  21. set tablist to (tabs of i whose URL contains tabURL)
  22. repeat with a in tablist
  23. if (count of tablist) > 0 then
  24. close item 1 of tablist
  25. end if
  26. end repeat
  27. end repeat
  28. end if
  29. end tell
Advertisement
Add Comment
Please, Sign In to add comment