[SOLVED] Multiline AppleScript box

My AppleScript knowledge is very limited, to say the least, so bear with me...
A while ago @noisneil shared a macro to create a new note that uses AS. The first AS action is this:

set ddText to text returned of (display dialog ¬
	"" default answer ¬
	"





" with title "New Note")

image

Everything works as expected, but I would like the first line to be seen as variableA and everything else to be variableB, so variableA would be the title, variableB would be the body/content.

I found this "solution", but I am not comfortable with what they are sharing:
https://discussions.apple.com/thread/2038077?answerId=2038077021#2038077021

Is this something relatively easy to achieve that someone could help me with?
If too complex, no worries. I can use a User Prompt for the title and then the AS action for the body/content. I just wanted to have everything in a single window if at all possible.

Thanks

AppleScript can't natively display more than one text field in a dialog. However, the Notes title will be whatever you set as the first line of content, so there's no need for a user prompt. Simply enter your title, a couple of new lines and then your body text:

2 Likes

Here's a custom HTML prompt version:

Catalina Quick Note (HTML).kmmacros (46 KB)

Macro screenshot

If you enter something into the Title field, the created note's title will be formatted correctly as heading text.

4 Likes

This wouldn't format the title the way a normal note does. All the text would be the same. At least not with the other macro you created.

Yes, this one rocks!
Visually more appealing, now I don't need the extra macro you added on the other version, and everything is formatted beautifully!
Thanks, Neil! This is perfect!! :raised_hands:

1 Like

Hi, @noisneil. How are you ? Can I ask you a question ?

Where did you find app defined ?

Here in the "Custom Floating HTML Prompt":

// Create a new note with the first line as heading text
var notes = app("Notes");

That part is actually unnecessary and should have been deleted. It doesnt affect function, so you can leave it if you like.

The note is actually created in the AppleScript that follows it.

Thank you for the answer and example macro you provided.