Economy-x-Talk - Sample Scripts
Dialog with Timeout and Error
"Kev-mo"
> I'd like the dialog box to remain on the screen for 60 seconds, then if
> nothing happens, have the dialog box disapper and the user would need to
> re-run the applet again.
Here you go.
If a button is clicked, the second dialog will appear. If no button is
clicked within one second, the dialog goes away and the the script
halts. The dialog "It didn't work." will never appear. Here is what
the event log contains:
tell current application
display dialog "foo" buttons {"OK", "not OK"} giving up after 1
--> {button returned:"", gave up:true}
--> User canceled.
Michelle Steiner
This script has been adjusted slightly to make it a good HC demo [MS].
on run {}
try
display dialog "foo" buttons {"OK", "not OK"} giving up after 1
set retText to the button returned of the result
if the retText is "OK" then
display dialog "OK"
else if the retText is "not OK" then
display dialog "Not OK"
else
error number -128 --simulates "user cancelled"
end if
on error errMsg number errNr
if errNr is -128 then
display dialog "It worked"
else
display dialog "It didn't work."
end if
end try
return errNr
end run
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.