Skip to content

Instantly share code, notes, and snippets.

@mayoff
Last active December 8, 2023 22:00
Show Gist options
  • Star 61 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save mayoff/1138816 to your computer and use it in GitHub Desktop.
Save mayoff/1138816 to your computer and use it in GitHub Desktop.
AppleScript to make Google Chrome open/reload a URL
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *)
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false
set theTabIndex to -1
repeat with theWindow in every window
set theTabIndex to 0
repeat with theTab in every tab of theWindow
set theTabIndex to theTabIndex + 1
if theTab's URL = theUrl then
set found to true
exit
end if
end repeat
if found then
exit repeat
end if
end repeat
if found then
tell theTab to reload
set theWindow's active tab index to theTabIndex
set index of theWindow to 1
else
tell window 1 to make new tab with properties {URL:theUrl}
end if
end tell
@mohan-chinnappan-n
Copy link

@jamesraylittle do we have an equivalent (to make Google Chrome open/reload a URL)
for Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment