No, it's not what I do.
On my side I replace the entire file by a clean copy.
#(SCRIPT keep_clean_prefs.app]
(*
To keep clean preferences files.
In your userAccount's Preferences folder,
create a subfolder named "safe_Prefs"
Store in this folder clean duplicates of the preferences files subject to corruption.
Save this script as an Application Bundle where you want.
Why not in your Applications folder?
Open the System Preferences Pane "Account"
Click on the "Login" tab.
Drag and drop the script's icon onto the window to add it to the list of login items.
On every boot process, the script will be run so it will install the clean prefs.
Of course, if you change something to the prefs and know that the file is clean,
duplicate the new version to the safe_prefs folder.
Yvan KOENIG
2008/05/26
2012/10/14 rebuilt
*)
on run
run mon_script
end run
script mon_script
set p2prefs to path to preferences from user domain as text
set p2Safe to p2prefs & "safe_Prefs:"
--if p2Safe does not end with ":" then set p2Safe to p2Safe & ":"
set prefNames to {"com.apple.applescript.plist"}
tell application "System Events"
repeat with aName in prefNames
try
delete disk item (p2prefs & aName)
end try
end repeat
exists folder p2Safe
end tell
if result then
try
do shell script "cp -R " & (quoted form of POSIX path of p2Safe) & space & quoted form of POSIX path of p2prefs
end try
end if # result
end script
#[/SCRIPT]
My scheme works as AppleScript Editor is not already loaded when the script is triggered.
So, when the editor will be called, it will load the newly installed preferences file.