Last active
October 3, 2019 08:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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