Return text AND button of dialog result.

Hi everyone,

I’m trying to write a script that begins with a display dialog and that returns the result of both the text entered and button selected.

Below is what I’ve tried, but it can’t get the returned values, I’m guessing this is because they are outside of the display dialog script.

(display dialog ¬
	"When do you want to set the reminder?" with title ¬
	"Set iCal Reminder" with icon note ¬
	default answer ¬
	"" buttons {"Cancel", "Days", "Weeks"} ¬
	default button 3 ¬
	)
set theButton to button returned
set theNumber to text returned

I thought this would be fairly basic, but can’t seem to find an answer anywhere.

Can anyone help?

Thanks in advance.

Rob

Hi. Those objects are returned from the result, which results in a new result with such activities as assigning a variable. The two line construction won’t work.

display dialog ¬
	"When do you want to set the reminder?" with title ¬
	"Set iCal Reminder" with icon note ¬
	default answer ¬
	"" buttons {"Cancel", "Days", "Weeks"} ¬
	default button 3 ¬
	
tell result to set {theButton, theText} to {button returned, text returned}



Awesome, thanks Marc! Perfect!