Evernote and finder tags

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Evernote and finder tags Mon Sep 07, 2020 9:42 pm • by kjz
I'm using Hazel to send PDF files to Evernote when the appropriately tagged file lands in the "Action Evernote" folder.

I wish to use the Finder tags as tags in EN via an embedded AppleScript.

When the input attribute Tags is chosen, the script generates an error.
If any other input attribute is chosen (size, comment, etc), the script runs with expected result.

The AS is as follows:

tell application id "com.evernote.evernote"

activate

set tag1 to item 1 of inputAttributes
set tag2 to item 2 of inputAttributes

create note from file theFile notebook "Journal Articles" tags {tag1, tag2}

end tell
kjz
 
Posts: 3
Joined: Mon Sep 07, 2020 9:14 pm

Re: Evernote and finder tags Tue Sep 08, 2020 9:55 am • by Mr_Noodle
What is the error? Also, note that Tags is a list and not a single value which may affect things.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Evernote and finder tags Wed Sep 09, 2020 9:46 pm • by kjz
I suspect "Tags is a list and not a single value" is the source of my misunderstanding and the error.

How would I reference and utilize the Finder Tags in the Tags list imported to the AppleScript? My goal is to duplicate the Finder tags in the Evernote note created by the script.

The Hazel log from the error is below. For context, the file being acted on is "Ophelia.pdf". It contains Tags "Journal Articles" and "stroke" and the Comment "test". The attributes imported into the script are Tags and Comment.

Thanks.


)}
2020-09-09 20:15:33.525 hazelworker[10326] Done processing folder Action
2020-09-09 20:19:16.240 hazelworker[10445] Running worker (v4.4.5) for folder with identifier: 16777220-12898099680.
2020-09-09 20:19:16.242 hazelworker[10445] ###main load address: 0x100244000
2020-09-09 20:19:16.242 hazelworker[10445] ###Noodle load address: 0x100361000
2020-09-09 20:19:16.242 hazelworker[10445] ###CK load address: 0x100329000
2020-09-09 20:19:16.276 hazelworker[10445] Processing folder Action EN (forced)
2020-09-09 20:19:18.288 hazelworker[10445] Ophelia.pdf: Rule Send to Evernote matched.
2020-09-09 20:19:22.194 hazelworker[10445] [Error] AppleScript failed: Error executing AppleScript on file /Users/kurt/Documents/Action EN/Ophelia.pdf.
2020-09-09 20:19:22.202 hazelworker[10445] OSAScript error: {
NSLocalizedDescription = "Evernote got an error: Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
NSLocalizedFailureReason = "Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: [0x0,17c47c3 \"Evernote\"]>";
OSAScriptErrorAppNameKey = Evernote;
OSAScriptErrorBriefMessageKey = "Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorMessageKey = "Evernote got an error: Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorNumberKey = "-1700";
OSAScriptErrorOffendingObjectKey = "<NSAppleEventDescriptor: [ [ 'utxt'(\"Journal Articles\"), 'utxt'(\"stroke\") ], 'utxt'(\"test\") ]>";
OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
kjz
 
Posts: 3
Joined: Mon Sep 07, 2020 9:14 pm

Re: Evernote and finder tags Wed Sep 09, 2020 9:46 pm • by kjz
I suspect "Tags is a list and not a single value" is the source of my misunderstanding and the error.

How would I reference and utilize the Finder Tags in the Tags list imported to the AppleScript? My goal is to duplicate the Finder tags in the Evernote note created by the script.

The Hazel log from the error is below. For context, the file being acted on is "Ophelia.pdf". It contains Tags "Journal Articles" and "stroke" and the Comment "test". The attributes imported into the script are Tags and Comment.

Thanks.


)}
2020-09-09 20:15:33.525 hazelworker[10326] Done processing folder Action
2020-09-09 20:19:16.240 hazelworker[10445] Running worker (v4.4.5) for folder with identifier: 16777220-12898099680.
2020-09-09 20:19:16.242 hazelworker[10445] ###main load address: 0x100244000
2020-09-09 20:19:16.242 hazelworker[10445] ###Noodle load address: 0x100361000
2020-09-09 20:19:16.242 hazelworker[10445] ###CK load address: 0x100329000
2020-09-09 20:19:16.276 hazelworker[10445] Processing folder Action EN (forced)
2020-09-09 20:19:18.288 hazelworker[10445] Ophelia.pdf: Rule Send to Evernote matched.
2020-09-09 20:19:22.194 hazelworker[10445] [Error] AppleScript failed: Error executing AppleScript on file /Users/kurt/Documents/Action EN/Ophelia.pdf.
2020-09-09 20:19:22.202 hazelworker[10445] OSAScript error: {
NSLocalizedDescription = "Evernote got an error: Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
NSLocalizedFailureReason = "Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: [0x0,17c47c3 \"Evernote\"]>";
OSAScriptErrorAppNameKey = Evernote;
OSAScriptErrorBriefMessageKey = "Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorMessageKey = "Evernote got an error: Can\U2019t make {{\"Journal Articles\", \"stroke\"}, \"test\"} into type list of text or list of tag.";
OSAScriptErrorNumberKey = "-1700";
OSAScriptErrorOffendingObjectKey = "<NSAppleEventDescriptor: [ [ 'utxt'(\"Journal Articles\"), 'utxt'(\"stroke\") ], 'utxt'(\"test\") ]>";
OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
kjz
 
Posts: 3
Joined: Mon Sep 07, 2020 9:14 pm

Re: Evernote and finder tags Thu Sep 10, 2020 10:16 am • by Mr_Noodle
Tags is already a list so the first item of inputAttributes will be a list already. No reason to have separate variables for each tag and then re-combine them for Evernote. Just assign the whole thing to one variable and send that one variable.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support