InDesign CS Applescript dialog box using "make dialog" problem...

Hello,

I was following the InDesign scripting guide and got a script for Printing to Postscript running. The only thing is, when you press “Cancel”, the script proceeds to complete the task rather than ending the script.

I’ve searched through MacScripter BBS and found some solutions, however, they use “display dialog” rather than “make dialog”. The InDesign Scripting Guide isn’t much help either. The code below is an excerpt from my script and I’m kind of baffled. I keep getting a “Can’t get button returned of dialog…” I suspect there’s something simple and obvious that I’m overlooking since I’m fairly new to Applescript. If someone can offer some help, I’d really appreciate it.

set myDialog to make dialog
	tell myDialog
		set name to "PDF North York Page"
		set myDialogColumn to make dialog column
		tell myDialogColumn
			set myBorderPanel to make border panel
			tell myBorderPanel
				set myDialogColumn to make dialog column
				tell myDialogColumn
					make static text with properties {static label:"Version:"}
				end tell
				set myDialogColumn to make dialog column
				tell myDialogColumn
					set myVersionField to make text editbox with properties ¬
						{edit contents:"1", min width:20}
				end tell
			end tell
			set myBorderPanel to make border panel
			tell myBorderPanel
				make static text with properties {static label:"Colour:"}
				set myColourGroup to make radiobutton group
				tell myColourGroup
					set myProRadioButton to make radiobutton control with properties ¬
						{static label:"Pro", checked state:true}
					set myBWRadioButton to make radiobutton control with properties ¬
						{static label:"B&W"}
				end tell
			end tell
		end tell
		show myDialog
		if button returned of myDialog = false then
			tell me to quit
		end if

Hi,

the show command in Indesign CS returns only a boolean value: true for OK, false for Cancel.
Button returned is a term of display dialog of Standard Scripting Additions

Hi Pmark

I think this is what stefan is getting at.
you can just loose the button returned bit.

tell application "Adobe InDesign CS2"
	set myDialog to make dialog
	tell myDialog
		set name to "PDF North York Page"
		set myDialogColumn to make dialog column
		tell myDialogColumn
			set myBorderPanel to make border panel
			tell myBorderPanel
				set myDialogColumn to make dialog column
				tell myDialogColumn
					make static text with properties {static label:"Version:"}
				end tell
				set myDialogColumn to make dialog column
				tell myDialogColumn
					set myVersionField to make text editbox with properties ¬
						{edit contents:"1", min width:20}
				end tell
			end tell
			set myBorderPanel to make border panel
			tell myBorderPanel
				make static text with properties {static label:"Colour:"}
				set myColourGroup to make radiobutton group
				tell myColourGroup
					set myProRadioButton to make radiobutton control with properties ¬
						{static label:"Pro", checked state:true}
					set myBWRadioButton to make radiobutton control with properties ¬
						{static label:"B&W"}
				end tell
			end tell
		end tell
		show myDialog
		if myDialog = false then
			tell me to quit
		end if
	end tell
end tell

it is always a good idea to post the full script no matter how big, sometimes snippets of
scripts can be more confusing than not posting one at all…

cheers

Hi pidge1,

you get the proper result of “show myDialog” with this:

if (show myDialog) = false then tell me to quit

Thanks Stefan!

Hey everybody…

Thank you very much for your posts… This was the first time I actually posted something, and thanks to your knowledge and support I was able to figure it out… I had to modify your solutions slightly because of the rest of the script, but it works flawlessly now.

In the future, I’ll post the whole script.

Thanks again,

Paul

Is there any other native Mac app that can allow similar dialogs to be created without the need of any scripting additions?

For example, this same type of script compiled with “Finder”?

If so, can anybody point me in the right direction. My search was futile :frowning:

Thanks,
-Jeff

Hi. Adobe baked in those commands to its applications. In order to have complex dialogs elsewhere, you need an app like Pashua or a library like Dialog Toolkit.

Thank you Marc, that’s what I figured but figured I would ask. I appreciate the response.

-Jeff