Jump to content
  • 0

Preserve MacOS tags on import


dgivnish

Idea

Posted

I'd like to import files that have been tagged in macOS. The tags are lost now on import into EN.

4 replies to this idea

Recommended Posts

  • Level 5*
Posted
On 2017-03-19 at 9:19 AM, dgivnish said:

I'd like to import files that have been tagged in macOS. The tags are lost now on import into EN.

Does this apply only to the Mac platform;
- where we implement an import folder using Applescript.
My solution would be to add this logic to the script

I'm also interested in the reverse; Preserve Evernote Tags on Export

  • Level 5*
Posted
On 2017-03-19 at 9:19 AM, dgivnish said:

I'd like to import files that have been tagged in macOS. The tags are lost now on import into EN.

Following up on this, I found this post at https://n8henrie.com/2015/08/converting-osx-finder-tags-to-evernote-tags-with-applescript/ with a script

Here's a rough script triggered by folder actions   Evernote Folder copy.scpt
I borrowed the "set the_tags" code from the link I posted.  It works, but is incredibly complex and I need time to study it.

Documentation on folder action scripts is here https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_folder_actions.html
The important points are58d0a5e136e11_ScreenShot2017-03-20at9_01_42PM.png.d50b5d2684868ceba15918adb041f50a.png
- store the script at   ~/Library/Scripts/Folder Action Scripts
- right click on your import folder, click on Services > Folder Actions Setup
- click on + to attach the script to the folder

 

 

 

on adding folder items to this_folder after receiving new_Files

 delay 5

repeat with new_file in new_Files

set the_tags to paragraphs of (do shell script "mdls -raw -name kMDItemUserTags " & quoted form of POSIX path of new_file & " | sed 's/^[()]$//g' | ruby -ne 'each = $_.strip.end_with?(\",\") ? $_.strip[0...-1] : $_.strip; puts each if each != \"\"'")

tell application "Evernote" to create note from file new_file tags the_tags
tell application "Finder" to delete new_file

end repeat

    end adding folder items to

 
Posted

It works well. However, the file tag of sample.tag is coming in as "sample.tag". Do I use a different delimiter in the string $_.strip.end_with?(\",\") ? $_.strip[0...-1] : $_.strip; puts each if each != \"\"'")?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...