Skip to content

Instantly share code, notes, and snippets.

@ChristoferK
ChristoferK / Chrome#(Re)Store URLs.applescript
Created November 15, 2019 21:20
[(Re)Store Chrome Tabs] Stores a list of open Chrome URLs, writing out to file and preserving arrangement; restores from file. #AppleScript #Chrome #Chromium #tabs #URLs #save #restore
property home : system attribute "HOME"
property file : home & "/.chrometabs"
on storeURLs()
close access (open for access my file)
tell application id "com.google.chrome" to ¬
set URLs to every window's tabs's URL
write the URLs to my file
@ChristoferK
ChristoferK / Safari#Filter Tabs By URL.applescript
Created October 13, 2020 15:27
[Match Safari Tabs Against URL Substring] A fast, efficient tab filter that operates over all tabs in all Safari windows to return a reference to those where the URL contains a given phrase. #AppleScript #Safari #browser #windows #tabs #URL #filter #search
on SafariTabsWhoseURLsContain:(phrase as text)
set text item delimiters to linefeed
tell application id "com.apple.Safari" to if it ¬
is running then tell every window to if ¬
it exists then tell (it where (index of ¬
tab 1 where phrase is in the URL) is in ¬
index of tabs) to tell (every tab whose ¬
URL contains the phrase) to if (exists) ¬
then return a reference to it
end SafariTabsWhoseURLsContain: