Last active
December 18, 2015 12:19
-
-
Save masnick/5781837 to your computer and use it in GitHub Desktop.
AppleScript to make a list of links for all the tabs in the frontmost window in an Evernote note.
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
tell application "Safari" | |
set docText to "" | |
set tabcount to number of tabs in first window | |
repeat with y from 1 to tabcount | |
set tabName to do shell script "ruby -e 'require %q[cgi]; print CGI.escapeHTML(ARGV[0])' " & quoted form of (name of tab y of first window as string) | |
set tabURL to do shell script "ruby -e 'require %q[cgi]; print CGI.escapeHTML(ARGV[0])' " & quoted form of (URL of tab y of first window as string) | |
set docText to (docText & "<en-todo/> <a href=" & "\"" & tabURL & "\">" & tabName & "</a><br/>" & linefeed as string) | |
end repeat | |
end tell | |
tell application "Evernote" | |
activate | |
set the theDate to do shell script "date '+%Y-%m-%d'" | |
create note title "Links for " & theDate as string with enml docText notebook "Links" | |
end tell | |
(* Debug *) | |
(* | |
tell application "TextEdit" | |
activate | |
make new document | |
set theDate to current date | |
set text of document 1 to docText as text | |
end tell | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment