AppleScript: How can I quit all running user apps and then restart to bootcamp partition (this part works)?

applescript, bootcamp, macos, restart

Solution

try using

tell application "Finder" to restart

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

Problem

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

Original source

Related problems