Skip to content

Instantly share code, notes, and snippets.

@jimfdavies
Last active July 3, 2018 13:15
Show Gist options
  • Save jimfdavies/41b7c973f961bc41a06b9fb58b8bd06a to your computer and use it in GitHub Desktop.
Save jimfdavies/41b7c973f961bc41a06b9fb58b8bd06a to your computer and use it in GitHub Desktop.
Safari Tab Cycler Applescript for dashboards, etc on Macs. Needs open Safari window(s) and presents startup options.
tell application "Safari"
set reloadQuestion to display dialog "Reload each tab?" buttons {"Yes", "No"} default button 2
set reloadAnswer to button returned of reloadQuestion
if reloadAnswer is equal to "Yes" then
set reloadTab to true
else
set reloadTab to false
end if
(choose from list {1, 5, 10, 30, 60} ¬
with prompt "Select delay time in seconds?" default items 30)
set delaySecs to result as text
repeat
repeat with i from 1 to (count of tabs of window 1) by 1
set thisTab to tab i of window 1
set current tab of window 1 to thisTab
if reloadTab then
set docUrl to URL of document 1
set URL of document 1 to docUrl
end if
delay delaySecs
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment