Jump to content

Applescript to Add Tags


Recommended Posts

I've just started playing with applescript in evernote. Granted applescript has it's oddities, but it seems more pronounced in evernote. What I am trying to do is create an applescript which will go through all the notes in my InBox (default notebook) and add tags based on their contents. For example, if the note has the word receipt in it, I'd like to add the receipt tag. Before I pull my hair out I thought I'd see if anyone has written a script like this that they would be willing to share.

Link to comment
  • 4 weeks later...

It's actually quite simple in Evernote:

 

tell application "Evernote"

set theNotes to every note in notebook "Inbox" whose title contains "Receipt"

repeat with eachNote in theNotes

assign tag "receipt" to eachNote

end repeat

synchronize

end tell

 

However, the latest version has broken multiple AppleScript items, including the ability to assign tags to notes via AppleScript.

 

Also, the "receipt" tag must already exist; if it doesn't create it.

 

I use a similar method with updating creation dates, assigning and then unassigning a tag so Evernote knows to sync the note.

Link to comment
  • 2 months later...
  • 9 months later...

9 months later I am also curious about whether or not the ability to assign a tag to selected notes via applescript is supposed to work, as I can't get it to either.  I get an error message.

Link to comment
  • 1 month later...

I'm not sure if this is the right thread to mention this, but I'm having trouble working with tags at all via applescript. I know Evernote just now resolved an issue with "notebook" in queries, and I was really banging my head against a wall with that one. What am I doing wrong?

 

 

tell application "Evernote"

set selectedNote to selection

set noteTags to tags of selectedNote

return noteTags

end tell

 

---> {}

 

I know the currently selected note has tags. I've tried this so many ways, setting class as list, referring to "name of tag" etc, but I get nothing. Is this a bug?

Link to comment

Thanks for responding! I'm cool with looping through tags, but I can't get evernote to return any information about tags. if I say "get tags of selectedNote" (and I know the selected note has tags) it returns null.  I tried looping and declaring class and a few other things, but I get error or null. If my code is correct, maybe there's a bug? 

Link to comment
  • Level 5

Thanks for responding! I'm cool with looping through tags, but I can't get evernote to return any information about tags. if I say "get tags of selectedNote" (and I know the selected note has tags) it returns null.  I tried looping and declaring class and a few other things, but I get error or null. If my code is correct, maybe there's a bug? 

 

No, your code is not correct. Like I said, selection is a list, so in the following code

 

set selectedNote to selection

set noteTags to tags of selectedNote

 

you’re setting selectedNote to a list of notes and then asking that list of notes for its tags.

That won’t work. A note has tags. A list of notes does not have tags.

Link to comment
  • 1 year later...
  • Level 5*

It may not be clear from the above posts that assigning tags to Notes is now working in
Evernote 6.7.1 (453574) on OSX 10.11.4

  tell application "Evernote"
    set noteList to selection
    set oNote to item 1 of noteList
    
    assign tag "MyTagName" to oNote
    
  end tell

 

Link to comment

Archived

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

×
×
  • Create New...