Created
September 23, 2012 19:44
-
-
Save webhat/3772793 to your computer and use it in GitHub Desktop.
Add File to Evernote with Tags
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Framework taken from Thought Asylum