Open Panel not working!

Hello all,

I’m not sure why but this script does not work, it never displays a dialog!

Please help!

Thanks!

on clicked theObject
	if the name of theObject is "submitButton" then
		display dialog ("This has been submitted.")
	else if the name of theObject is "cancelButton" then
		tell me to quit
	else if the name of theObject is "loadButton" then
		display dialog ("Loading...")
	else if the name of theObject is "chooseButton" then
		set treat packages as directories of open panel to true
		set can choose directories of open panel to false
		set can choose files of open panel to true
		set allows multiple selection of open panel to false
		display open panel attached to window "mainWindow"
	end if
end clicked

on panel ended theObject
	--if the name of theObject is "chooseButton" then
	--set ppdLocation to path name of open panel
	display dialog "The panel was ended, so I am envoked."
	--end if
end panel ended

Also, I’m wondering how I could display a dialog as a sheet, that I could build in IB, I’d like to have a progress bar, and text that gets updated, along with a cancel button.

Thanks in advance.

Hi,

wrong forum, please post Xcode questions into the Xcode forum :wink:

Take a look at the Open Panel Sample project in /Developer/Examples/AppleScript Studio/Open Panel/.
To attach a custom panel to a window you have to create a new nib file with code like

property panelWIndow : missing value

on loadPanel()
	if panelWIndow is missing value then
		load nib "InformationPanel"
		set panelWIndow to window "Information"
	end if
end loadPanel

loadPanel()
display panel panelWIndow attached to window "main"

on panel ended theObject with result theResult
	close panel theObject
	if theResult is 1 then
	-- do something	
	else if theResult is 2 then
	-- do other things
	end if
end panel ended


Moved the topic to the appropriate forum :wink: