AppleScript:如何退出所有正在运行的用户应用程序,然后重新启动到 bootcamp 分区(这部分有效)?

发布于 2024-07-26 07:57:46 字数 921 浏览 2 评论 0原文

我经常在 Mac Pro (e2008) (Mac Os X 10.5.6) 的 bootcamp 分区上重新启动到 Windows。 因为我喜欢利用重新启动所需的时间来做其他事情,而不是只是坐在那里,所以我想编写/执行一个简单的苹果脚本,它基本上可以做到:

  1. 退出所有正在运行的用户应用程序
  2. 然后* -正确退出应用程序后,*重新启动到我的训练营分区

第 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:

  1. Quit all running user applications
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

归属感 2024-08-02 07:57:46

尝试使用

tell application "Finder" to restart

此尝试退出每个应用程序,同时提示保存,然后重新启动计算机

try using

tell application "Finder" to restart

this try to quit every application, while prompting for saves, and then reboot the computer

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文