How would I test the value of theObject when panel closing?

I am using some code from AppleScript Studio’s “Open Panel” example for the user to choose a destination folder inside a sheet/panel. After the panel closes it calls the on panel ended handler. Later I discovered that my panelized progress bar would call the same handler when it closed.

on panel ended theObject with result withResult
end on panel ended

So I need to react differently when my progress bar is closing than when the choose destination folder panel is closing.

I was thinking I would have an if block testing theObject since while withResult would be 1 in only one case it could be 0 in both cases. But I’m not sure what the test should be, since the value of theObject isn’t just text.

Can someone suggest the answer?

Values upon entering handler…
After Choose Destination panel:
http://www.automaticduck.com/screenshots/openPanel.jpg

After progress bar closes:
http://www.automaticduck.com/screenshots/windowID2.jpg

Hi,

first of all, please post Xcode questions in the Xcode forum.

theObject is never text, it’s a reference to the target object.
For example you could check the window

Something like this would work…

on panel ended theObject with result withResult
		if withResult is 1 then
			if theObject is open panel then
				
			else if name of theObject is "myProgressbarPanelName" then
				
			end if
		end if
end panel ended

Thank you, Hank, that was perfect.