Skip to content

Instantly share code, notes, and snippets.

@s4y
Last active April 24, 2020 03:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save s4y/7e7ce25ce2d0c0ff3d0c108ddf30c233 to your computer and use it in GitHub Desktop.
Save s4y/7e7ce25ce2d0c0ff3d0c108ddf30c233 to your computer and use it in GitHub Desktop.
AppleScript which reloads a Whole Foods delivery confirmation page and displays a notification when time slots are available or it otherwise needs attention (e.g. because an item has become unavailable)
tell application "Safari"
repeat
repeat with theWindow in every window
repeat with theTab in every tab of theWindow
if name of theTab contains "Reserve a Time Slot" then
set checkoutWindow to theWindow
set checkoutTab to theTab
end if
end repeat
end repeat
tell checkoutTab
set URL to URL
delay 10
if text of checkoutTab does not contain "No delivery windows available" then
display notification "Amazon needs your attention!" sound name "Sosumi"
set current tab of checkoutWindow to checkoutTab
set index of checkoutWindow to 1
end if
end tell
delay 90
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment