Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created July 7, 2015 18:42
Show Gist options
  • Save badsyntax/1f4a58715194d780b2f6 to your computer and use it in GitHub Desktop.
Save badsyntax/1f4a58715194d780b2f6 to your computer and use it in GitHub Desktop.
Open or reload a URL in Google Chrome with AppleScript
#!/usr/bin/env bash
osascript -e "
tell application \"Google Chrome\"
activate
set theUrl to \"$1\"
set found to false
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
set tabIndex to 0
repeat with atab in tabList
set tabIndex to tabIndex + 1
if (URL of atab contains theUrl) then
set found to true
tell atab to reload
set aWindow's active tab index to tabIndex
end if
end repeat
end repeat
if not found then
open location theUrl
end if
end tell"
@mohan-chinnappan-n
Copy link

Do we have an equivalent for MS Windows?

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