Ok guys,
I'm just getting back to this amongst several other projects, but I thought I'd re-address it. I'm creating the script to disable windows from the previous login under 10.7. In order to do this it seems I need to create the same script for applications that launch and create the associated plist.
Example:
sudo defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false
I don't know of another way around this, but to create the same script multiple times for the additional applications into a bash script.
Heres my example of the script in totally that I've created:
#!/bin/bash
# Disable Native Mac Applications from ReOpening from previous login
sudo defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false
sudo defaults write org.mozilla.firefox NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.google.Chrome NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.TextEdit NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.Mail NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.iTunes NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.iPhoto NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.TimeMachine NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.iCal NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.appstore NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.iWork NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.apple.AddressBook NSQuitAlwaysKeepsWindows -bool false
# Disable Third-party Mac Applications from ReOpening from previous login
sudo defaults write com.microsoft.Outlook NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.microsoft.Powerpoint NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.microsoft.Word NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.microsoft.Excel NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.microsoft.Messenger NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.microsoft.rdc NSQuitAlwaysKeepsWindows -bool false
sudo defaults write com.adobe.Reader NSQuitAlwaysKeepsWindows -bool false
# Will exit with status of last command.
exit
When I run the script, I get the following error:
sudo: no tty present and no askpass program specified
I'd like to package all this in a bash script or perl script and perform a single shot in terminal.