Display dialog and select button after so long
Display dialog and select button after so long
- Subject: Display dialog and select button after so long
- From: "Ball, Dan" <email@hidden>
- Date: Wed, 24 Aug 2011 18:38:48 -0400
- Acceptlanguage: en-US
- Thread-topic: Display dialog and select button after so long
I have to be thinking to hard.....please help!
The checkbox when you shutdown in Lion is a pain and I made a little script to go around it somewhat. Someone who I shared it with wants it to display the dialog with the default button of shutdown and then timeout after 10 seconds and shutdown. I know that if you use giving up after 10 it closes out and does nothing, I thought it would use the default button set and select it after 10 seconds but doesn't. WHat am I missing? Also is it possible to display the countdown in the display window?
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
display dialog "Please select your option!" & "
Will timeout in 10 seconds!" buttons {"Restart", "Shutdown", "Cancel"} default button 2 with icon 0 giving up after 10
set the user_choice to the button returned of the result
if the user_choice is "Restart" then
my script_help("ScriptEditor001")
return false
else if the user_choice is "Shutdown" then
my script_help2("ScriptEditor002")
return false
else if the user_choice is "Cancel" then
return false
end if
end tell
end tell
-- Restart button
on script_help(this_anchor)
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
click menu item "Restart…" of menu 1 of menu bar item "Apple" of menu bar 1
end tell
end tell
tell application "System Events"
tell process "loginwindow"
activate
click checkbox 1 of window 1
click button "Restart" of window 1
end tell
end tell
end script_help
-- Shutdown Button
on script_help2(this_anchor)
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
click menu item "Shut Down…" of menu 1 of menu bar item "Apple" of menu bar 1
end tell
end tell
tell application "System Events"
tell process "loginwindow"
activate
click checkbox 1 of window 1
click button "Shut Down" of window 1
end tell
end tell
end script_help2 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden