AppleScript:如何退出所有正在运行的用户应用程序,然后重新启动到 bootcamp 分区(这部分有效)?
我经常在 Mac Pro (e2008) (Mac Os X 10.5.6) 的 bootcamp 分区上重新启动到 Windows。 因为我喜欢利用重新启动所需的时间来做其他事情,而不是只是坐在那里,所以我想编写/执行一个简单的苹果脚本,它基本上可以做到:
- 退出所有正在运行的用户应用程序
- 然后* -正确退出应用程序后,*重新启动到我的训练营分区
第 2 部分,我已经使用了一段时间了,我在网上找到了一个脚本,如下所示:
do shell script "bless -mount /Volumes/WinVista/ -legacy -setBoot -nextonly" with
administrator privileges
do shell script "shutdown -r now" with administrator privileges
这非常有效,只是如果应用程序打开,它们不会正确关闭(基本上它们是“强制退出”)所以我想让脚本先关闭应用程序,然后执行重新启动。
我在 Stack Overflow 上发现了一个类似的问题,但由于我对 AppleScript 的理解几乎不存在,我不知道如何将其结合起来:(使用 Applescript 退出所有应用程序?)并使用重新启动的脚本。
这可能吗? 如果是这样,我将不胜感激您向我提供的任何建议/帮助/脚本。
此外,我几乎没有使用 AppleScripting 的经验,到目前为止我所做的只是复制/粘贴我在网上找到的内容,以防万一。
感谢您的阅读。
詹尼斯
I frequently reboot into Windows on a bootcamp partition in my Mac Pro (e2008) (Mac Os X 10.5.6). Because I like to use the time it takes to reboot for other things instead of just sitting around I'd like to write/execute a simple applescript that would basically do:
- Quit all running user applications
- Then*—after the apps have been quit properly—*restart to my bootcamp partition
Part 2 I have been using for a little while now with a script I found online that is as follows:
do shell script "bless -mount /Volumes/WinVista/ -legacy -setBoot -nextonly" with
administrator privileges
do shell script "shutdown -r now" with administrator privileges
This works great except that if applications are open they are not properly shutdown (basically they are being 'force quit') so I would like to have the script shutdown apps first then execute the reboot.
I have found a similar question on Stack Overflow but since my understanding of AppleScript is virtually none existent I don't know how I could combine this: (Quit All Applications using Applescript?) with the script that does the reboot.
Is this possible?
If so I would appreciate any advice/help/scripts you can throw at me.
Also I have virtually no experience with AppleScripting all I have done so far was copy/pasting what I had found online, just in case that matters.
Thank you for reading.
Jannis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
此尝试退出每个应用程序,同时提示保存,然后重新启动计算机
try using
this try to quit every application, while prompting for saves, and then reboot the computer