OS X Lion: Fensterwiederherstellung für einzelne Programme sperren
11/08/2011defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false via OS X Lion: Fensterwiederherstellung für einzelne Programme sperren « macnews.de.In der Library, unter Saved Application State werden alle Programme aufgeführt, bei denen ein solcher SavedState bereits gespeichert wurde =) also warum nicht ein kleines Skript:--11.08.2011 little script to edit saved state settings for a single app instead of all apps
global myhome
tell application "Finder"
set myhome to POSIX path of (home as alias)
set theitems to name of every item of folder "Saved Application State" of folder "Library" of home
set theapps to {}
repeat with theitem in theitems
if (theitem as text) ends with ".savedState" then
set theapps to theapps & ((characters 1 through -12 of theitem as text) as text)
end if
end repeat
end tell
set theapp to (choose from list theapps with prompt "Which app with saved state?") as text
set theactions to {"Delete SavedState", "Disable SavedState", "Enable SavedState", "Freeze Saved State", "Defrost Saved State"}
set theaction to (choose from list theactions with prompt "Which action?") as text
if theaction = (item 1 of theactions) as text then
my deleteSavedState(theapp)
else if theaction as text = (item 2 of theactions) as text then
my disableSavedState(theapp)
else if theaction as text = (item 3 of theactions) as text then
my enableSavedState(theapp)
else if theaction as text = (item 4 of theactions) as text then
my freezeSavedState(theapp)
else if theaction as text = (item 5 of theactions) as text then
my defrostSavedState(theapp)
end if
on deleteSavedState(appName)
--moves avedState to user's trash folder and plays drag to trash sound
do shell script "mv " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState ~/.Trash/;afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/dock/drag\\ to\\ trash.aif"
end deleteSavedState
on disableSavedState(appName)
--uses defaults write to disable saved state for this particular app
do shell script "defaults write " & appName & " NSQuitAlwaysKeepsWindows -bool false"
do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"
end disableSavedState
on enableSavedState(appName)
--uses defaults write to disable saved state for this particular app
do shell script "defaults write " & appName & " NSQuitAlwaysKeepsWindows -bool true"
do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"
end enableSavedState
on freezeSavedState(appName)
--changes user permissions to read only, so that savedStated is frozen
do shell script "chmod u-w " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState"
do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"
end freezeSavedState
on defrostSavedState(appName)
--changes user permissions to read&write again, so that savedStated is not frozen any more
do shell script "chmod u+w " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState"
do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"
end defrostSavedState