First I read this and I can’t seem to get this to work.
Let’s say I have this plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PDN8176440</key>
<dict>
<key>content</key>
<string>Some Content</string>
<key>rundates</key>
<array>
<string>5/27/2012</string>
<string>6/3/2012</string>
<string>6/10/2012</string>
</array>
</dict>
<key>PDN8221358</key>
<dict>
<key>content</key>
<string>Some More Content</string>
<key>rundates</key>
<array>
<string>6/3/2012</string>
<string>6/10/2012</string>
<string>6/17/2012</string>
</array>
</dict>
</dict>
</plist>
Which for this example resides here:
set theOutputFolder to path to desktop folder as string
set thePListPath to theOutputFolder & "myPListFile"
(defaults doesn’t want the plist extension it seems)
And I wish to delete the key “PDN8176440”
set keytogo to "PDN8176440"
set mycommand to ("defaults delete " & (quoted form of POSIX path of thePListPath) & " " & keytogo) as string
do shell script mycommand
Results in:
(note my path in the script I’m using is different than my example so it says path to plist because it’s desktop or whatever… it’s an example, the script does find the file.)
There is no (PDN8176440) default for the (path to plist:myPListFile.plist) domain.
Defaults have not been changed.
Perhaps I’m not understand how to use defaults because this returns the list:
set mycommand to ("defaults read " & (quoted form of POSIX path of thePListPath)) as string
return do shell script mycommand
So what am I doing wrong here?