任何人都知道如何修复这个 applescript?
Anyone have any idea how to fix this applescript?
display dialog "Your Computer Has Been Taken Over By Ninja Cows With Flamethrowers!" buttons {"Ok......"} default button 1
display dialog "How Would You Like To Proceed?" buttons {"Milk Them", "Burn Them", "Do Nothing"} default button 1
if the button returned of the result is "Milk Them" then
beep 1
delay 1
display dialog "You milk them day and night but unlucky you spilt the milk on to the computer, the computer crashes and the batery shoots out, you failed" buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
else
if the button returned of the result is "Do Nothing" then
display dialog "The cows look at you, they are just staring eager to destroy somthing, after 23 hours and 59 minutes they burn the place to the ground, rupturing the lithium ion battery.
your computer explodes, you explode and everything explodes." buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
end if
if the button returned of the result is "Burn Them" then
display dialog "You grab a even bigger flamethrower from your bottemless bag and burn them to the ground YOU DID IT!, unfortunataly apples new chipset in not designed to withstad such heat, the computer explodes, you explode, everything explodes. Hey, atleast you got the cows this time.." buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
end if
end if
end
原因是内部变量result
总是包含前一行的结果。
使用这个:
set buttonReturned to button returned of (display dialog "How Would You Like To Proceed?" buttons {"Milk Them", "Burn Them", "Do Nothing"} default button 1)
if buttonReturned is "Milk Them" then
-- proceeed button 1
else if buttonReturned is "Do Nothing" then
-- proceeed button 2
else
-- proceeed button 3
end if
display dialog "Your Computer Has Been Taken Over By Ninja Cows With Flamethrowers!" buttons {"Ok......"} default button 1
display dialog "How Would You Like To Proceed?" buttons {"Milk Them", "Burn Them", "Do Nothing"} default button 1
if the button returned of the result is "Milk Them" then
beep 1
delay 1
display dialog "You milk them day and night but unlucky you spilt the milk on to the computer, the computer crashes and the batery shoots out, you failed" buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
else
if the button returned of the result is "Do Nothing" then
display dialog "The cows look at you, they are just staring eager to destroy somthing, after 23 hours and 59 minutes they burn the place to the ground, rupturing the lithium ion battery.
your computer explodes, you explode and everything explodes." buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
end if
if the button returned of the result is "Burn Them" then
display dialog "You grab a even bigger flamethrower from your bottemless bag and burn them to the ground YOU DID IT!, unfortunataly apples new chipset in not designed to withstad such heat, the computer explodes, you explode, everything explodes. Hey, atleast you got the cows this time.." buttons {"Wait, What?"} default button 1
tell application "Finder"
shut down
end tell
end if
end if
end
原因是内部变量result
总是包含前一行的结果。
使用这个:
set buttonReturned to button returned of (display dialog "How Would You Like To Proceed?" buttons {"Milk Them", "Burn Them", "Do Nothing"} default button 1)
if buttonReturned is "Milk Them" then
-- proceeed button 1
else if buttonReturned is "Do Nothing" then
-- proceeed button 2
else
-- proceeed button 3
end if