Last active
August 29, 2015 13:57
-
-
Save d108/9891026 to your computer and use it in GitHub Desktop.
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
-- Copy a file into the currently selected note in Evernote as an attachment. | |
-- | |
-- Usage: | |
-- | |
-- osascript copyLastFileAsEvernoteAttachment.scpt | |
-- | |
-- @filename copyLastFileAsEvernoteAttachment.scpt | |
-- @author Daniel Zhang (張道博) | |
-- Define the source path using a Mac OS type of path. | |
-- Example: drive-name:folder:subfolder | |
set myPath to "${MY_CUSTOM_AUDIO_PATH}" | |
set p to myPath as alias | |
tell application "Finder" | |
set latestFile to item 1 of reverse of (sort (get files of (p)) by creation date) as alias | |
set myFilename to latestFile's name | |
end tell | |
tell application "Evernote" | |
set theNote to selection | |
set theNoteTitle to (title of item 1 of theNote) as string | |
set theCreatedDate to (creation date of item 1 of theNote) as date | |
set noteItem to item 1 of theNote | |
tell noteItem to append attachment latestFile | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment