Re: How to add new property list item into a property list file.
Re: How to add new property list item into a property list file.
- Subject: Re: How to add new property list item into a property list file.
- From: Tetsuro KURITA <email@hidden>
- Date: Mon, 4 Sep 2006 14:07:19 +0900
Thnaks for the reply.
I can not find the suggested way. But I don't like converting property list
items into records. Because AppleScript's record class has a critical
limitation that labels of records can not used as variables. Off course, I
know some scripting addtions allow to avoid the limitation of AppleScript.
And I know the way to use 'do shell script' command and 'defaults' command.
I hope a solution in the frame of Property List Suite of System Events.
> Here's one way ...
>
> tell application "System Events"
> set thePlistFile to property list file thePath
> set fileRec to (value of property list file thePlistFile)
> end tell
> set fileRec to fileRec & {newName:newValue}
> tell application "System Events"
> set value of property list file thePlistFile to fileRec
> end tell
>
> When you read/write the value of the plist file, you are reading/writing the value of 'root' which is usually of type 'Dictionary'. (A plist "Dictionary' is equivalent to an AppleScript 'record'.)
>
> On Sep 3, 2006, at 7:39 PM, Tetsuro KURITA wrote:
>
>> I was trying to add a new property list item into a property list file using
>> Property List Suite of System Event. The code is as follows.
>>
>> tell application "System Events"
>> set thePlistFile to property list file thePath
>> make new property list item at end of contents of targetPlistFile with properties {value:"theValue", name :"theName"}
>> end tell
>>
>> No error happen, but no new entry is not created in the plist file. How to
>> add new entry into a property list file ?
>>
>> =======================================================
>> Tetsuro KURITA
>> E-mail: email@hidden
>> =======================================================
>>
>> _______________________________________________
>> 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
>
_______________________________________________
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