Create a New Note From AppleScript

I was going to write “I’m too busy to do a test right now…” but curiosity got the better of me. :rofl:

Not quite true, as it does set the $Prototype for the new note. That gives as a clue. The two non-working calls are dialog-derived values and AppleScript Debugger’s variables/value list shows me entryTitle is not—as you suppose—a string but the value of result of the dialog call, which is a list of two properties.

What you actually want is the value of the ‘text returned’ property of the dialog. So change:

set entryTitle to display dialog "Entry Title?" default answer ""
copy the result to {button returned:buttonPressed, text returned:titleString}
set entryText to display dialog "Entry Text?" default answer ""
copy the result to {button returned:buttonPressed, text returned:entryString}

To

set entryTitle to text returned of (display dialog "Entry Title?" default answer "")
set entryText to text returned of (display dialog "Entry Text?" default answer "")

and it works. Huzzah for AppleScript Debugger’s richer reports on what AppleScript does, as I’m no export. The chink of light here was noting that only the prototypes using dialog-derived values weren’t working. I’ll freely admit chasing several wrong conclusions en route to the right one.

Also ended up fixing a few formatting a typo errors in aTbRef—happily in body text not code samples. Those corrections are now rectified in the live HTML pages (and zipped TBX).

1 Like