-
-
Save philippeowagner/8194095 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(* | |
Applescript to launch a diff tool to compare two notes in Evernote. | |
Useful to compare conflicting notes | |
1. Place the script file in ~/Library/Scripts/Applications/Evernote | |
2. Ensure Applescript menu bar item is on. Option to turn on/off is under General Preferences in AppleScript Editor | |
3. The variable difftool can be change to any command line tool you require | |
*) | |
-- opendiff launches FileMerge.app developer tool | |
-- /Applications/Xcode.app/Contents/Applications/FileMerge.app | |
set difftool to "/usr/bin/opendiff" | |
--set difftool to "/usr/bin/visdiff" | |
tell application id "com.evernote.Evernote" | |
try | |
set selected_notes to selection | |
if (count of selected_notes) = 2 then | |
set firstNoteId to my getNoteId(local id of (item 1 of selected_notes)) | |
set secondNoteId to my getNoteId(local id of (item 2 of selected_notes)) | |
set evernoteLibPath to (POSIX path of (path to library folder from user domain as string)) & "Application Support/Evernote/accounts/Evernote/" | |
set evernoteUserid to name of (get current account) | |
set contentPath to evernoteLibPath & evernoteUserid & "/content/" | |
-- Noticed HTML file may be identical content, but some lines might be joined together on single long lines, | |
-- so compare Evernote enml XML data file instead | |
do shell script difftool & " '" & contentPath & "/" & firstNoteId & "/content.enml' '" & contentPath & "/" & secondNoteId & "/content.enml'" | |
else | |
display alert "Compare Two Notes:" message "Please select only 2 notes to compare" | |
end if | |
on error error_message number error_number | |
display alert "Compare Two Notes: ERROR" message "Error running script (" & error_number & ") : " & error_message as warning | |
end try | |
end tell | |
on getNoteId(note_id) | |
set AppleScript's text item delimiters to "/" | |
set the id_items to every text item of note_id | |
set AppleScript's text item delimiters to "" | |
return last item of id_items | |
end getNoteId | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment