AppleScript: how can I exit all running user applications and then restart the bootcamp section (this part works)?

I often reboot into Windows on the bootcamp section on my Mac Pro (e2008) (Mac Os X 10.5.6). Since I like to use the time it takes to reboot for other things, instead of just sitting there, I would like to write / execute a simple applicator, which basically would do:

  • Close all running user applications
  • Then * - after the applications have been closed correctly - * reboot into my bootcamp section

Part 2 I use some time with a script that I found on the Internet that looks like this:

do shell script "bless -mount /Volumes/WinVista/ -legacy -setBoot -nextonly" with 
administrator privileges
do shell script "shutdown -r now" with administrator privileges

This works fine, except that if the applications are open, they do not work properly (basically they "force shutdown"), so first I would like to run the applications to disable the script applications, and then reboot.

I found a similar question in Stack Overflow, but since my understanding of AppleScript practically does not exist, I don’t know how I could combine this: ( Close all applications using Applescript? ) With a script that performs a reboot.

Is it possible? If so, I would appreciate any tips / hints / scripts that you can throw on me.

Also, I have practically no experience with AppleScripting, all I have done so far is copying / pasting what I found on the Internet, just in case.

Thanks for reading.

+3
1

tell application "Finder" to restart

, ,

+6

Source: https://habr.com/ru/post/1711865/


All Articles