Re: Adding a property value to a plist file
Re: Adding a property value to a plist file
- Subject: Re: Adding a property value to a plist file
- From: dev_sleidy <email@hidden>
- Date: Wed, 12 Jul 2006 00:40:09 -0400
... My problem here lies in how do I create a new property in the
plist file (making the plist longer).
So... I would be creating new ARYLib properties and increment them
as I do. Also, if someone would also give me the snippet to remove
properties from a plist file that would be nice too
Launch 'Terminal' and enter ...
man defaults
... and press the <return> key. Everything you need is there.
In the example below, the '.plist' file created in the original post,
is titled 'com.jesse.almanrode.plist'.
01. In 'Terminal' if you enter ...
defaults read com.jesse.almanrode
... and press the <return> key - will result with ...
{ARYLib1 = ("Some String", "Some other String", false); }
... If, in 'Script Editor' and you enter ...
do shell script "defaults read com.jesse.almanrode"
... and click the 'Run' button - the result will be ...
"{ARYLib1 = (\"Some String\", \"Some other String\", false); }"
02. To create a new array, in 'Terminal', enter ...
defaults write com.jesse.almanrode ARYLib2 -array This\ is\ item\ 1
This\ is\ item\ 2 true
... and press the <return> key. Then enter ...
defaults read com.jesse.almanrode
... and press the <return> key, ...
'{
ARYLib1 = ("Some String", "Some other String", false);
ARYLib2 = ("This is item 1", "This is item 2", true);
}'
... will result. If, in 'Script Editor', and you enter ...
do shell script "defaults write com.jesse.almanrode ARYLib2 -array
This\\ is\\ item\\ 1 This\\ is\\ item\\ 2 true"
do shell script "defaults read com.jesse.almanrode"
... and click the 'Run' button ...
"{
ARYLib1 = (\"Some String\", \"Some other String\", false);
ARYLib2 = (\"This is item 1\", \"This is item 2\", true);
}"
... will result.
03. To delete the 'ARYLib1' key, in 'Terminal', enter ...
defaults delete com.jesse.almanrode ARYLib1
... and press the <return> key . Then enter ...
defaults read com.jesse.almanrode
... and press the <return> key. ...
{ARYLib2 = ("This is item 1", "This is item 2", true); }
... will result. If, in 'Script Editor' and you enter ...
do shell script "defaults delete com.jesse.almanrode ARYLib1"
do shell script "defaults read com.jesse.almanrode"
... and click the 'Run' button - the result will be ...
"{ARYLib2 = (\"This is item 1\", \"This is item 2\", true); }"
I am sure I can figure it out but hey, why re-invent the wheel if
you don't have to?
...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden