View Full Version : [Resolved] I need help

Mar 16, 2013, 04:00 PM
I am a new user to Mac and I need help.
The error is:
Canít get button returned.
I am trying to prank my friend with this script that I will save as an application.

display dialog "VIRUS! VIRUS!" buttons {"Destroy it"} default button 1
if button returned is "Destroy it" then
tell application "Finder" to sleep
display dialog "You cannot destroy me" buttons {"Yes I can"}
else if button returned is "Yes I can" then

tell application "System Preferences" to activate

end if

Any help is appreciated

Mar 16, 2013, 05:35 PM
First step is to post your code. People cant help you unless they see the code that is not working.

Mar 16, 2013, 05:39 PM
Try this :

if button returned of the result = "Destroy it" then


set theResult to button returned of (display dialog "VIRUS! VIRUS!" buttons {"Destroy it"} default button 1)
if theResult is "Destroy it" then

Ask yourself what will happen then. You need to work on your logic.

Mar 16, 2013, 06:04 PM
Thanks kryten2,
it worked good