Jump to content
  • 0

(Archived) Validation errors after creating new local database


ethan_annis

Idea

I just used an apple script that I found in a forum to copy my notes from my Apple Mail application to Evernote. It appeared that the notes were in Evernote on my desktop client but I kept getting the message "Multiple validation errors occurred." After I closed Evernote and moved the Evernote, application support file onto the Mac desktop, as suggested and then reopened Evernote, all my notes were gone. I synced the notes again and am getting the same message.

Of course, I have multiple backups of my notes on the Apple side but I'd like to get my notes into Evernote, sans error of course.

Any suggestions.

Thanks,

Ethan

Link to comment

2 replies to this idea

Recommended Posts

Hi Ethan,

I was seeing exactly the same problem as you, but I've now fixed it.

For me, the issue was caused by an imported note having a title field of greater than 255 characters (which is the limit in Evernote).

For me, when I was importing notes there were two counters incrementing in the Evernote interface. The first one was next to 'All Notebooks' and the second was next to 'Imported Notes'. I could tell when things had gone wrong, as the 'All Notebooks' counter would keep incrementing when the 'Imported Notes' counter had stopped.

The number it stopped at is the number of the note that is broken. Trying to work out what was wrong, I introduced a delay statement in the AppleScript, and just after the problem note was imported, I stopped the script. At this point, Evernote popped up an error dialogue saying that the title field was too long.

I've made some changes to the Applescript which fix the problem for me. Basically, I'm now truncating the title field to less than 255 characters.

The new script is as follows:

tell application "Evernote"

create notebook "Imported Notes" with type local only

end tell

tell application "Mail"

set theMessages to every message of the mailbox "NoteMigrate"

repeat with thisMessage in theMessages

set myTitle to the subject of thisMessage

set truncatedTitle to my truncateString(myTitle, 254)

set myText to the content of thisMessage

set myCreateDate to the date sent of thisMessage

tell application "Evernote"

create note with text myText ¬

title truncatedTitle ¬

notebook ¬

"Imported Notes" tags ¬

"imported_note" created myCreateDate

end tell

delay 3

end repeat

end tell

on truncateString(txt, max)

set txtLength to (length of txt)

if txtLength > max then

set txt to (text 1 thru (max - 1) of txt) & "=85" as string

end if

return txt

end truncateString

The script doesn't do any error checking, so you'll need to ensure that the 'Imported Notes' notebook doesn't exist before running the script. This is because I explicitly create it as a local notebook, to save having to trying and delete a corrupted notebook from the online service. Once I successfully imported my notes, then I copied them across to a syncing notebook.

I did still get a couple of notes that wouldn't sync properly, but you can easily spot these as the note thumbnail becomes blank after processing through my script. You can still see the note body, so you can just manually remove these from the 'NoteMigrate' mailbox, and then try running the script again. If you do delete them, then be sure to empty the trash as well, otherwise the script still picks them up.

I've now managed to import all of my notes. I only had to add 3 notes manually, which I simply copied and pasted from the original Apple note.

I've left the 'delay 3' statment in there, just so I can keep tabs on what's going on. It really helps with spotting the problem notes. You can always lower the number, or remove it entirely to speed things up.

Hope this helps,

Bagpuss.

Link to comment

This is very useful information. I modified it slightly and got all my notes imported.

I'd been trying to import my notes from my iPhone, by first syncing the iPhone to Apple Mail, and then trying to send them to Evernote using scripts like Veritrope's script ( http://veritrope.com/code/apple-mail-to ... uage-beta/ ) or the simpler one at http://forum.evernote.com/phpbb/viewtopic.php?f=38&t=9112 . Regardless, after a few notes are imported, I kept getting an error. Evernote said "Internal Error. An internal database error has occurred that prevents Evernote from functioning properly. If the problem persists, please contact Evernote Support." Applescript then said "Connection invalid" -- that the connection with Evernote was lost.

I finally figured out that it was the Evernote title length limitation was the problem.

First I used Bagpuss's solution, but it didn't completely solve it. I think the 255-character limit may be in fact lower than that (perhaps because of the "=85" added in the Applescript?). Anyhow, I lowered the limit to 200 characters and got every single note imported.

This is my script, importing from a Notes subfolder called Notes Archive and going into an already-created Evernote folder called "Imported iPhone Notes"

tell application "Mail"
set theMessages to every message of the mailbox "Notes/Notes Archive"
repeat with thisMessage in theMessages
set myTitle to the subject of thisMessage
set truncatedTitle to my truncateString(myTitle, 200)
set myText to the content of thisMessage
set myCreateDate to the date sent of thisMessage
tell application "Evernote"
create note with text myText title truncatedTitle notebook "Imported iPhone Notes" created myCreateDate tags "imported_note"
end tell
end repeat
end tell


on truncateString(txt, max)
set txtLength to (length of txt)
if txtLength > max then
set txt to (text 1 thru (max - 1) of txt) & "=85" as string
end if
return txt
end truncateString

Link to comment

Archived

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

×
×
  • Create New...