I insert this code:
tell application "Notes"
set theMessages to every note
repeat with thisMessage in theMessages
set myTitle to the name of thisMessage
set myText to the body of thisMessage
set myCreateDate to the creation date of thisMessage
set myModDate to the modification date of thisMessage
tell application "Evernote"
set myNote to create note1 with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes"]
set the HTML content of myNote to myText
set the creation date of myNote to myCreateDate
set the modification date of myNote to myModDate
end tell
end repeat
end tell
And it gives me the error: Syntax Error Expected end of line but found identifier.
Any idea what the problem with the code is?
Best Answer
The problem is the version of Evernote I tried is not AppleScript scriptable.
When trying to add Evernote to the Library in Script Editor, in order to review its AppleScript dictionary, it errs with: Add Item Unable to add the item because it is not scriptable.
Additionally, when running the following command in Script Editor:
Its result is: false
Apparently at one time Evernote was AppleScript scriptable, however, in macOS Catalina, testing with Evernote from https://evernote.com/download/ and checking Evernote > About Evernote it shows:
Looking for the typical AppleScript dictionary in
/Applications/Evernote.app/Contents/Resources/
there is no Evernote.sdef file as would be expected if it was fully AppleScript scriptable.If you do have a version of Evernote that is AppleScript scriptable then try the following, which I cannot test under the circumstances:
Change
note1
tonote
in:You might also want to put in some parentheses. e.g.
Unfortunately without a version of Evernote that is AppleScript scriptable, I cannot offer more.