Display panel wait for result

i made a handler to display a panel attached to the main window, but i want it to wait for user input (clicking a button) before continuing execution of the script (like what a dialog does) is this possible?

I don’t think that’s possible LobsterMan.

FWIW, here’s a few snippets from a small project I started the other day:

on checkDownloadStatus()
	if downloading is true then
		display alert "Not Finished Updating" as warning default button "Continue" other button "Quit" attached to window 1
		return false
	else
		return true
	end if
end checkDownloadStatus

on should close theObject
	checkDownloadStatus()
end should close

on should quit theObject
	checkDownloadStatus()
end should quit

on alert ended theObject with reply theReply
	if button returned of theReply is "Quit" then
		set downloading to false
		quit
	end if
end alert ended

Model: Mac mini
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)

this is weird, i just tried the regular display dialog, and when it’s attached to a window, the script won’t wait :frowning: does this mean i have to give up elegance for performance, or is there a workaround?

Can you post your code?


...
set content of progress indicator "ProgressBar" of window "ProgressPanel" to 100
	close panel (window "ProgressPanel")
	display dialog "Congratulations! Your album is ready." attached to window "MainWindow"
	tell application "Safari"
		activate
		open index_file
	end tell

safari opens up before any user input

After you connect the “dialog ended” event to “MainWindow” in Interface Builder, try this:

-- on something()
	-- .
	set content of progress indicator "ProgressBar" of window "ProgressPanel" to 100
	close panel (window "ProgressPanel")
	display dialog "Congratulations! Your album is ready." attached to window "MainWindow"
-- end something

on dialog ended theObject with reply theReply
	-- If nessecary, check for correct object/reply
	tell application "Safari"
		activate
		open index_file
	end tell
end dialog ended

ouch! i thought so. the problem with chopping it up into lots of handlers (for every dialog) is the variables, i’ll probably have to make them globals, as i see no other way ti pass them on

Globals or properties, whichever is appropriate.

I’ve somewhat accomplished this goal with the following routine that I put in my script

on pause_confirm()

	display panel window "paused" attached to window "my_app"
	set continuteVal to "paused"
	repeat while continuteVal is not equal to "Continuing..."
		set continuteVal to title of button "continue" of window "paused"
		delay 1
	end repeat
	close panel window "paused"	
	
end pause_confirm

Where the panel has a button that when they click calls a script that changes it’s title to Continuing… The delay 1 is to keep the script resources lower, maybe.

Dunno if this helps (or is too late), but hopefully it does some good.