Skip to content

Instantly share code, notes, and snippets.

@dreki
Created April 15, 2014 13:38
Show Gist options
  • Save dreki/10733400 to your computer and use it in GitHub Desktop.
Save dreki/10733400 to your computer and use it in GitHub Desktop.
Update to "Back up Safari Tabs to Evernote" Applescript by twitter.com/ttscoff that adds favicons.
-- SET METADATA
property Title : "Title: URL List from Safari Tabs"
property Notebook : "Notebook: Reading List"
property Tags : "Tags: linklist, temp"
-- DATE STAMP
set dateStamp to do shell script "date '+%Y-%m-%d, %I:%M %p'"
-- PREPARE THE LIST
set urlList to {}
set currentTab to 0
-- GET TABS FROM SAFARI
tell application "Safari"
set safariWindow to first window
set tabCount to (count of (tabs of safariWindow))
try
repeat with t in (tabs of safariWindow)
set currentTab to currentTab + 1
set tabTitle to (name of t)
set tabURL to (URL of t)
if currentTab is not equal to tabCount then
set tabInfo to ("* <img src=\"http://g.etfv.co/" & tabURL & "\" width=\"16\" height=\"16\" /> [" & tabTitle & "](" & tabURL & ")" & return)
else
-- don't output double return on last tab
set tabInfo to ("* <img src=\"http://g.etfv.co/" & tabURL & "\" width=\"16\" height=\"16\" /> [" & tabTitle & "](" & tabURL & ")")
end if
copy tabInfo to the end of urlList
end repeat
end try
end tell
set urlList to (Title & " — " & dateStamp & return & Notebook & return & Tags & return & return & urlList) as text
return urlList as text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment