• 0
dgivnish

Preserve MacOS tags on import

Idea

4 replies to this idea

Recommended Posts

  • 0
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

Share this post


Link to post
  • 0
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

 

Share this post


Link to post
  • 0

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 != \"\"'")?

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now