( NSAlert ) - Creating a Display Alert with a 10 second time out
( NSAlert ) - Creating a Display Alert with a 10 second time out
- Subject: ( NSAlert ) - Creating a Display Alert with a 10 second time out
- From: Paul G <email@hidden>
- Date: Mon, 21 Feb 2011 14:52:24 +1000
Hi everyone,
Shane a while back showed me how to create a display alert using
NSAlert, now I need to add to that and specify a time out.
Here's the original AS code so you know what I mean:
display dialog "Setup has finished successfully." & return & "Press
OK to restart your computer now." & return & "Auto-Restarting in 10
seconds." buttons {"OK"} default button "OK" giving up after 10
try
do shell script "ps acx | grep Finder"
tell application "/System/Library/CoreServices/System Events.app" to restart
on error
Sudo("shutdown -r now")
end try
This is what I have so far:
set theAlert to current application's NSAlert's
alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_("Setup
finished successfully.", "Restart Now", missing value, missing value,
"The application has finished successfully and will Auto-Restart the
system in 10 seconds.")
set theReply to (theAlert's runModal()) as integer
Can NSAlert be given a timeout option somehow? I havn't found anything
in my reading yet.
What's the best way to tell the machine to restart and make sure that
it happens after the 10 seconds or when the user clicks the "restart"
button
--
--
Regards,
Paul G
Professional Services Technician
Apple Certified Desktop Technician
Apple Certified Portable Technician
Apple Certified Macintosh Technician
Apple Certified Help Desk Specialist
Apple Certified Technical Co-Ordinator
Apple Product Professional (2008)
Paul Grice | Macintosh Specialist / Design & Development Officer
Operational Development | Information Management Services
Corporate and Professional Services
Department of Education & Training
Floor 11 | Education House | 30 Mary Street | Brisbane Qld 4000
T 3405 3814 | M 0402 643 758 | E email@hidden
http://deta.qld.gov.au/
Our Vision | a clever, skilled and creative Queensland
Please consider the environment before printing this email
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden