Jump to content
Pete248

(Archived) Bug: Moving a note via Applescript is not reflected in the Mac Client

Recommended Posts

When I move a note from one notebook to another via Applescript, I see the new location in the notebook popup of of moved note. Also the number of notes in the notebook pane changes accordingly.

But when I select the destination notebook in the notebook pane, the moved note is not there. Instead it still shows up in the original notebook.

This cannot be fixed with a sync or a shutdown/restart of the client.

In the web interface, the note is displayed in the correct notebook after a sync.

Would be nice, if you could fix this and/or give me a workaround how to update the client's notes index manually if possible.

Pete

Share this post


Link to post

Some more info:

If I loop through a list of notes within a single Applescript, moving notes works as expected.

If I call an Applescript repetitively from another app and move just a single note, it doesn't work reliable. Out of 65 notes only 58 showed up in the destination notebook, 7 were still in the original notebook. The notebook popup in these 7 notes strangely stated, that these note would be in the destination notebook. I left the client idle for some time in case it is just a timing issue and he might update the notebooks later, but the notes still showed up in the wrong notebook after an hour.

Pete

Share this post


Link to post

Another finding ...

I tried to circumvent the problem mentioned by adding a "move" tag to the notes and in a separate step move the notes by searching for the "move" tag and looping through the list within a second Applescript. Strangely this didn't work either. Reason was, that the client didn't find the "move" tag on a search, although it was showing up within each of the notes.

It seems that occasionally changes made through Applescript are not reflected correctly in the Mac client.

Has anyone else seen such things when using Applescript?

Pete

Share this post


Link to post

Another finding ...

I tried to circumvent the problem mentioned by adding a "move" tag to the notes and in a separate step move the notes by searching for the "move" tag and looping through the list within a second Applescript. Strangely this didn't work either. Reason was, that the client didn't find the "move" tag on a search, although it was showing up within each of the notes.

It seems that occasionally changes made through Applescript are not reflected correctly in the Mac client.

Has anyone else seen such things when using Applescript?

Pete

Share this post


Link to post

I found, the issue is related to a timing problem.

Want to see it yourself? Try this:

First run this Applescript to set things up (it is taken from Evernotes Applescript examples):


tell application "Evernote"

create notebook "AppleScriptNotebook1"
create notebook "AppleScriptNotebook2"
create note title "Note 1" with text "Moving note" notebook "AppleScriptNotebook1"

set tag1 to make tag with properties {name:"AppleScriptTag1"}
set tag2 to make tag with properties {name:"AppleScriptTag2", parent:tag named "AppleScriptTag1"}
set tag3 to make tag with properties {name:"AppleScriptTag3", parent:tag named "AppleScriptTag1"}

end tell

You now have 2 new notebooks, 1 note and 3 tags for your testing.

Now run this Applescript:


tell application "Evernote"

set matches to find notes "notebook:AppleScriptNotebook1"

set tag1 to tag named "AppleScriptTag1"
set tag2 to tag named "AppleScriptTag2"
set tag3 to tag named "AppleScriptTag3"

repeat with theNote in matches
set title of theNote to "Note 2"
assign {tag1, tag2, tag3} to {theNote}

-- delay 1

move theNote to notebook "AppleScriptNotebook2"

end repeat
end tell

Check your Evernote client. You should see one note named "Note 2" when you select AppleScriptNotebook1 in the side pane (what is wrong), although the Notebook popup in the note says, that this note is actually in AppleScriptNotebook2 (what is correct). If you show the number of notes in the side pane, you should see zero notes in AppleScriptNotebook1 and one note in AppleScriptNotebook2 (what is correct). You can't fix things by syncing or closing/reopening the Evernote client.

Move the note to another notebook and then back to AppleScriptNotebook1 (which is the only way to fix the issue), delete the assigned tags (or delete everything that was generated and start over with the first Applescript). Now remove the 2 dashes in front of "delay 1" to make it active and run the second Applescript again. Now the note is tagged and moved properly and shows up in the correct notebook.

I suggest, Evernote should build-in some tests into the Applescript implementation, so that commands are queued and executed properly when they are issued in a fast sequence.

Pete

Share this post


Link to post

Pete,

 

Thanks for your detective work on this. I think I've run into the same problem.  I have an Applescript that changes note tags and then moves notes to different notebooks.  Notes treated this way haven't been syncing correctly between my two Macs, particularly with respect to which notebook they're in.  I'll try adding a delay to my Applescript to see if that fixes things.

 

I'd love to hear something from the Evernote folks on this, but my guess is that Evernote + Applescript users are a pretty small slice of the user base, and they've got bigger fish to fry.  :(

Share this post


Link to post
Guest
This topic is now closed to further replies.

×
×
  • Create New...