AppleScript error... Catalina?

I’m trying to help a colleague troubleshoot an AppleScript problem. Script works fine on my machine (Mojave) but errors out on his (Catalina). Any insights on interpreting the error message and why it is failing on one Mac but not the other? I’m assuming Catalina as that is the primary difference, but wondering if I’m overlooking another possible cause. Thanks in advance for any advice — jay

I’ll preface this with noting that I’m not on Catalina yet; waiting on some app updates first. But, Notes certainly had some updates in the release; so it certainly could be related to Notes interactions specifically.

Here’s a couple of high level thoughts on this.

The error suggests it is the show line, so has it created the note? the fact that there is an ID suggests to me it has. Can you copy the ID and convert that in a separate script to rule out it simply being an odd timing issue.

Have you checked if there are any name or syntax changes in the AppleScript dictionary for Notes in Catalina? Specifically around the use of show?

I don’t think it is the show. If that line is commented out the script will still crash. I will dig in to the timing idea on Monday when I’m back in the office and have time with my colleague’s Mac.

I’ll also try to add some other examples of the crash. This actually originated in a hazel script. Crashing as the file was added to the Apple Note. To simplify the troubleshooting I moved to Script Editor and kept peeling away code.

In fact, the original problem script is the same as the one I referenced in this earlier thread. Works fine for me, but not for my colleague.

I’m troubleshooting a script with essentially the same structure, and I get the SAME error. This script WILL create the note, it just won’t display it. Here’s a link to the question I asked, which is basically the same as yours. I’d appreciate any help I can get. @jayelevy tag me if you find a solution.

@Peter_Schorn I’ve struck out on my troubleshooting. Exhausted what I’m capable of and am still absent a solution. Frustrating. Maybe somebody else here will have other ideas. Does seem like a Catalina bug (or internal change). — jay

I would like to create an apple script that opens a pre-existing note from Apple’s Notes application. How do I do this?

I adapted this script from here:

tell application "Notes"
    tell account "On My Mac"
	    set newNote to make new note at folder "XYZ" with properties {name:"Test", body:"body text"}
	    show newNote -- this is the text that gets highlighted when the error occurs
    end tell
end tell

It creates a new note in the correct location, however it does not open the note. Instead, I get this error message:

error “Notes got an error: Can’t make show id “x-coredata://95ABF30B-037A-471B-81DD-42ACC847D91B/ICNote/p2938” into type specifier.” number -1700 from show id “x-coredata://95ABF30B-037A-471B-81DD-42ACC847D91B/ICNote/p2938” to specifier

Again, I want to open a pre-existing note. This script is just a test so I can try to figure out what to do.

I’ve merged together these topics to keep the relevant information in one place.

1 Like

A quick bit of Googling revealed the below, but TL;DR, it looks like there’s a bug.

Hook Blog Post - Apple Notes Catalina Bugs

Catalina (10.15) Notes AppleScript is broken, lots of -1700 errors when interacting with note objects

This section (and the rest of the document) will be updated with further details as the situation develops with Apple or our own investigations.

We hope that Apple will address issues with its macOS 10.15 Notes app. Also, we have a line of investigation open to work around some of them.

I tried using elements of their posted workaround for the ID to see if I could utilise that for a newly minted note. While I think they may also have had a typo, I still continued to get coercion errors with what I tried based on the details they shared.

Apple Developer Forums - How to resolve an AppleScript error 1700?

Oh wait, you’re on 10.15 beta! That does have a selection property, but the app’s scripting seems to be having general problems.

Whilst not a direct selection, I think this might have been a symptom of the same issue.

We have posted the feedback FB7074402.

Thanks for sharing this information. Glad to know that it is a known issue.

@Peter_Schorn @jayelevy

Does this work?

tell application "Notes"
	show note "Place Pre Existing Note Name Here"
end tell

:man_shrugging:t3: I’ve since retired so my former colleagues are now on their own for ancillary Apple support. :rofl:

make return an unique id for object not a name

tell application "Notes"
	tell account "On My Mac"
		set newNoteID to make new note at folder "Notes" with properties {name:"Test", body:"body text"}
		show note (name of newNoteID)
	end tell
end tell