My Apple Script Editor code doesn't work gives “Syntax Error Expected end of line but found identifier.”

apple.stackexchange https://apple.stackexchange.com/questions/418986

  •  01-06-2021
  •  | 
  •  

Domanda

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?

È stato utile?

Soluzione

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:

tell application "System Events" to ¬
    get has scripting terminology of application process "Evernote"

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:

10.11.5-mac-ddl-public (2530)
Editor: v121.2.15734
Service: v1.32.4
© 2019 - 2021 Evernote Corporation. All rights reserved

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 to note in:

set myNote to create note1 with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes"]

You might also want to put in some parentheses. e.g.

set myNote to (create note with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes"])

Unfortunately without a version of Evernote that is AppleScript scriptable, I cannot offer more.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a apple.stackexchange
scroll top