我不知道我在做什么错误,但在此命令完成后,脚本结束还有另一个命令来完成,谁会知道我做错了什么。由于脚本结束后,即使仍然有更多的命令
我在进入这个,它贯穿
tell application "Finder"
activate
display dialog "Are you sure you want to shut down your computer now?" buttons {"Restart", "Sleep", "Shutdown"} with icon alias ((path to me as text) & "Contents:Resources:power.icns")
if the button returned of the result is "Restart" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Restarting..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
restart
end tell
else
if the button returned of the result is "Sleep" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Sleeping..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
sleep
end tell
else
if the button returned of the result is "Shutdown" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Shutting Down..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
shut down
end tell
,这是来自之后的命令,但不运行
set appLocation to path to me as string
set theFile to appLocation & "Contents:Resources:iPanic.app"
tell application "Finder" to open file theFile
delay 8
tell application "Terminal"
activate
set currentTab to do script {"defaults write com.apple.LaunchServices LSQuarantine -bool YES"}
delay 1
do script {"Killall Finder"} in currentTab
end tell
感谢你告诉我所有这些:)我仍然在学习苹果脚本,我的脚本有点混乱,但是这有助于。我只是想知道我的 'finalpart() restart' 做我需要做的代码,每个按钮(休眠,重启,关机)即可。因此,对于睡眠命令,我将把子程序放在最后的'finalpart(),sleep'中,并且我必须复制并粘贴每个命令的子程序 – 2014-09-29 03:20:05