【发布时间】:2017-02-17 17:15:11
【问题描述】:
这个苹果脚本保存为应用程序 Mac_restart.app 运行 Mac_restart.app mac restart 并重新启动后,此应用程序仍作为正在运行的应用程序在 Dock 上,我可以再次单击重新启动它,我已添加应用程序退出但它不起作用。 我想在重新启动后完全使用这个应用程序,并且不想在 Dock 上作为打开的应用程序。 我错过了什么?请帮忙。
如果我不把 try 放在整个脚本应用程序中,AppleEvent 超时(-1712)一段时间后会抛出错误,我可以看到我不想要的 Edit 选项,这就是它放的原因整个 try 并且如果我在上面的处理程序上尝试它仍然会继续重新启动我想要的直到我按下重新启动它不会重新启动它。 以下是重启后未退出应用程序的最终应用程序。休息很好。
try
with timeout of 400 seconds
tell application "Finder"
display dialog "Create Folder & Restart." buttons {"Cancel", "Ok"} default button 1 with icon 0 with title "Create Folder & Restart" giving up after 400
if the button returned of the result is "Cancel" then
return
end if
end tell
end timeout
try
do shell script "mkdir -p /Volumes/MAC/Users/jack/Desktop/2014"
do shell script "mkdir -p /Volumes/MAC/Users/jack/Desktop/2015"
do shell script "mkdir -p /Volumes/MAC/Users/jack/Desktop/2016"
do shell script "mkdir -p /Volumes/MAC/Users/jack/Desktop/2017"
end try
tell application "Finder"
activate
display dialog "Click on Restart." with icon 0 buttons ("Restart") giving up after 60
end tell
tell application "Finder"
restart
end tell
end try
【问题讨论】:
标签: macos applescript