Re: Display dialog and select button after so long
Re: Display dialog and select button after so long
- Subject: Re: Display dialog and select button after so long
- From: "Ball, Dan" <email@hidden>
- Date: Thu, 25 Aug 2011 15:46:28 -0400
- Acceptlanguage: en-US
- Thread-topic: Display dialog and select button after so long
Ok......I'm stuck again. Please help...
Its looking for a button choice.....if it gives up it shouldn't look for a
user_choice. About 8 lines down from the top....STUCK HERE is where I am
stuck. Tried putting else but wouldn't take.
Thanks,
Dan
---------------------------------------------------------------------------
--------
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 giveUp to (gave up of the result)
if giveUp is true then my shutdownscript("ShutdownScript")
STUCK HERE
set the user_choice to the button returned of the result
if the user_choice is "Restart" then
my restartscript("RestartScript")
return false
else if the user_choice is "Shutdown" then
my shutdownscript("ShutdownScript")
return false
else if the user_choice is "Cancel" then
return false
end if
end tell
end tell
-- Restart button
on restartscript(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 restartscript
-- Shutdown Button
on shutdownscript(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
delay 9
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 shutdownscript
-- Script created by Daniel Ball with some code from Victor Andreoni from
www.gizmoblurb.com
_______________________________________________
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