title: AppleScript: How can I quit all running user apps and then restart to bootcamp partition (this part works)?
body: <p>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:</p>
  
  <ol>
  <li>Quit all running user applications</li>
  <li><strong>Then*</strong>—after the apps have been quit properly—*restart to my bootcamp partition</li>
  </ol>
  
  <p>Part 2 I have been using for a little while now with a script I found online that is as follows:</p>
  
  <pre><code>do shell script "bless -mount /Volumes/WinVista/ -legacy -setBoot -nextonly" with 
  administrator privileges
  do shell script "shutdown -r now" with administrator privileges
  </code></pre>
  
  <p>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.</p>
  
  <p>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: (<a href="https://stackoverflow.com/questions/495323/quit-all-applications-using-applescript">Quit All Applications using Applescript?</a>) with the script that does the reboot.</p>
  
  <p>Is this possible?
  If so I would appreciate any advice/help/scripts you can throw at me.</p>
  
  <p><em>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.</em></p>
  
  <p>Thank you for reading.</p>
  
  <p>Jannis</p>