Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristoferK/d0e0f577ecdba769ad3be48366975404 to your computer and use it in GitHub Desktop.
Save ChristoferK/d0e0f577ecdba769ad3be48366975404 to your computer and use it in GitHub Desktop.
[If URL Open, Then: Activate Tab; Else: Open URL] A discerning URL opener for any Chromium-based web browser that eliminates the need for iteration. #AppleScript #Chromium #Open #URL #browser #Chrome #Brave
to open location www
--OR: application id "com.google.Chrome"
tell application id "com.brave.Browser" to tell windows to tell (it ¬
where integer 1 in ((tab 1's id where www is in URL) & 0) ¬
is in the id of every tab) & false to tell the first item
if it = false then return continue open location www
set i to character id (id of tab 1 where www is in URL)
set t to character id (id of tabs)
set the active tab index to the offset of i in t
activate
set index to 1
end tell
end open location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment