AppleScript Preferences Editor

This is a simple AppleScript preferences editor. Please let me know what you think and/or report any bugs you find.

(* AppleScript preferences editor by DevEd2
   Licensed under GNU GPL v3. *)
property debug : 0
display dialog "Enter the domain of the application whose preferences you want to edit." default answer "" buttons {"Cancel", "OK"} default button 2
set theDomainToEdit to the text returned of the result
display dialog "Enter the name of the preference you want to edit." default answer "" buttons {"Cancel", "OK"} default button 2
set theSelectedItem to the text returned of the result
display dialog "Enter a new value for " & theSelectedItem & "." default answer "" buttons {"Cancel", "Delete", "OK"} default button 3
if the button returned of the result is "Delete" then
	do shell script "defaults delete " & theDomainToEdit & " " & theSelectedItem
	set deleted to 1
else
	set theNewValue to the text returned of the result
	do shell script "defaults write " & theDomainToEdit & " " & theSelectedItem & " " & theNewValue
	set deleted to 0
end if
if theDomainToEdit is "com.apple.dock" then
	display dialog "You will need to restart Dock for these changes to take effect." buttons {"Cancel", "Restart"} default button 2
	if the button returned of the result is "Restart" then
		do shell script "killall Dock"
	end if
else if theDomainToEdit is "com.apple.finder" then
	display dialog "You will need to restart Finder for these changes to take effect." buttons {"Cancel", "Restart"} default button 2
	if the button returned of the result is "Restart" then
		do shell script "killall Finder"
	end if
else
	display dialog "You will need to restart the application for these changes to take effect." buttons {"Cancel", "OK"} default button 2
end if
set DeletedString to "Deleted " & theSelectedItem & " of " & theDomainToEdit & "."
set ChangedString to "Changed " & theSelectedItem & " of " & theDomainToEdit & " to " & theNewValue & "."
if debug is 1 then
	if deleted is 1 then
		display dialog DeletedString
	else
		display dialog ChangedString
	end if
else
	if deleted is 1 then
		return DeletedString
	else
		return ChangedString
	end if
end if

BTW If you want to enable verbose mode, just change “property debug: 0” to “property debug: 1”.