Advertisement
n8henrie

Convert OpenMeta Tags to Evernote Tags

Sep 11th, 2012
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Find original post here: http://n8henrie.com/2012/06/converting-openmeta-tags-to-evernote/
  2. -- set theFile to alias “YourHDName:Users:YourUserName:Path:To:TestFile.pdf” –uncomment this line  for testing in Applescript Editor!
  3. local importedFrom, targetNotebook, openmeta, tagtext, taglist, tid
  4. --Which notebook do you want the notes to end up in? **Case Sensitive**
  5. set targetNotebook to “Inbox”
  6. --Add a tag to tell what app the files were imported from
  7. set importedFrom to “from_Leap”
  8. --Set openmeta location to wherever you have installed openmeta
  9. set openmeta to/usr/local/bin/openmeta”
  10. --Get tags as one big string
  11. set tagtext to do shell script openmeta &-t -p ” & quoted form of POSIX path of theFile
  12. --Remove file path from tags (don’t know why openmeta includes this as a tag)
  13. set filePath to POSIX path of theFile
  14. set pathOffset to offset of filePath in tagtext
  15. set tagtext to (strings 1 thru (pathOffset – 2) of tagtext) & ” ” & importedFrom
  16. set tid to AppleScript‘s text item delimiters
  17. set AppleScript‘s text item delimiters to {” “}
  18. set taglist to the words of tagtext
  19. -- display dialog “taglist: ” & return & taglist & return & return & “tagtext: ” & return & tagtext
  20. --Change the TIDs back
  21. set AppleScript‘s text item delimiters to tid
  22. --preserve the original created and modified dates of the files
  23. tell application “Finder”
  24. set createdFileDate to (the creation date of (theFile as alias))
  25. set modFileDate to (the modification date of (theFile as alias))
  26. end tell
  27. tell application “Evernote”
  28. launch
  29. set theItem to create note from file theFile notebook targetNotebook tags taglist created createdFileDate
  30. set (modification date of theItem) to modFileDate
  31. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement