Skip to content

Instantly share code, notes, and snippets.

@webhat
Created September 23, 2012 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webhat/3772793 to your computer and use it in GitHub Desktop.
Save webhat/3772793 to your computer and use it in GitHub Desktop.
Add File to Evernote with Tags
on run {input}
tell application "Evernote"
repeat with SelectedFile in input
try
display dialog "Tags for " & SelectedFile default answer ""
set value to text returned of result
set AppleScript's text item delimiters to ","
set the_tags to text items of value
set the_tags to the_tags & {"file", "paper", "book"}
create note from file SelectedFile notebook "Auto Import" tags the_tags
on error errMessage number errNumber
if the errNumber is equal to 4 then
-- The file being imported is not supported
set userCanceled to false
try
display dialog "Your Evernote account does not support the import of this type of file. Why not consider upgrading?" buttons {"Cancel", "Go Premium"} default button "Cancel" cancel button "Cancel" with icon caution
on error number -128
set userCanceled to true
end try
-- If the user wishes they can be taken to the Evernote premium upgrade page
if userCanceled is false then
tell application "Safari"
activate
open location "https://www.evernote.com/Checkout.action"
end tell
end if
else
-- Unspecified failure
display alert "Import into Evernote failed" message "Error(" & errNumber & "): " & errMessage as warning
end if
end try
end repeat
end tell
end run
@webhat
Copy link
Author

webhat commented Sep 23, 2012

Framework taken from Thought Asylum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment