System Preferences/General/Ask to keep changes when closing documents

I’d like to check “Ask to keep changes when closing documents” in the General Pane of System Preferences (MacOSX10.8)

I have this:


tell application "System Preferences"
	activate
	set the current pane to pane id "com.apple.preference.general"
end tell

tell application "System Events"
	tell process "System Preferences"
		tell window "General"
			if value of checkbox "Ask to keep changes when closing documents" is 0 then
				click checkbox "Ask to keep changes when closing documents"
			end if
		end tell
	end tell
end tell

(*
tell application "System Preferences" to quit
*)

…though I’d prefer not to use GUI.

Is there a shell script?
Or can I modify a plist?

Thanks

As far as I know, this feature is ruled by the property NSQuitAlwaysKeepsWindows (a boolean) stored in the file :

(path to preferences folder as text)&".GlobalPreferences.plist

KOENIG Yvan (VALLAURIS, France) lundi 9 septembre 2013 22:06:31

Got it! It’s NSCloseAlwaysConfirmsChanges
Thanks for pointing out the right direction.