Skip to content

Instantly share code, notes, and snippets.

@fabiofortkamp
Created July 16, 2014 23:43
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 fabiofortkamp/d6b937bdcac186a216e4 to your computer and use it in GitHub Desktop.
Save fabiofortkamp/d6b937bdcac186a216e4 to your computer and use it in GitHub Desktop.
AppleScript to show a list of Safari tab URLS, to be used with TextExpander, but it crashes
tell application "System Events"
set numSafari to count (every process whose name is "Safari")
end tell
if numSafari > 0 then
tell application "Safari"
set URLList to {}
set windowCount to number of windows
repeat with win from 1 to windowCount
set tabCount to number of tabs in window win
repeat with thisTab from 1 to tabCount
set tabURL to URL of tab thisTab of window win
set the end of URLList to tabURL
end repeat
end repeat
set chosenURL to choose from list URLList
end tell
get "[%|](" & chosenURL & ")"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment