Re: XML - System Events vs XMLlib
Re: XML - System Events vs XMLlib
- Subject: Re: XML - System Events vs XMLlib
- From: Bruce Robertson <email@hidden>
- Date: Fri, 31 Aug 2007 00:02:19 -0700
> "Bruce Robertson" wrote:
>
> "Hamish" wrote:
>
>>> tell application "System Events"
>>> -- make new plist item
>>> set plist to make new property list item with data "<?xml version=
>>> \"1.0\" encoding=\"UTF-8\"?>
>>> <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
>>> \"http:// www.apple.com/DTDs/PropertyList-1.0.dtd\">
>>> <plist version=\"1.0\">
>>> <dict>
>>> <key>keyname</key>
>>> <integer>8</integer>
>>> <key>creation</key>
>>> <string>2007:06:12 20:13:52</string>
>>> <key>happy</key>
>>> <false/>
>>> </dict>
>>> </plist>
>>> "
>
>> Since no file was defined, "where" is this property list item? If it is
>> simply an applescript variable why do we need to delete it?
>>
>> Also what is «class seld» ? It does not appear to be a writable property.
>>
>> set pl to plist as record
>> pl
>> --> {«class form»:named, «class want»:property list item, «class
>> seld»:"untitled 7", from:application "System Events"}
>
> Bruce,
>
> you're looking at results that are turned into a record, so you're making a
> bit of smoke for yourself.
>
> If you were to run the code above [as shown here, not with the 'delete'
> lines] twice in a fresh Smile terminal, then you'd have two Plist objects in
> memory. The results would be:
>
>
> -- property list item "untitled" of application "System Events"
> -- property list item "untitled 2" of application "System Events"
>
>
> If you want to keep multiple objects in memory like that, you can name your
> Plists.
>
> tell application "System Events" to...
>
> set the name of property list item 1 to "hello" -- <<class seld>> here
> its property list item 1
> -- property list item "hello" of application "System Events"
>
> set the name of property list item 2 to "dolly"
> -- property list item "dolly" of application "System Events"
>
>
>
>
> You can then refer to them by name:
>
>
> tell application "System Events" to...
>
> tell property list item "hello" to its properties
> -- {kind:record, name:"hello", class:property list item,
> value:{happy:false, creation:"2007:06:12 20:13:52", keyname:8}}
>
>
> tell property list item "dolly" to its properties
> -- {kind:record, name:"dolly", class:property list item,
> value:{happy:true, creation:"2007:06:12 20:13:52", keyname:12}}
>
>
>
> HTH.
>
> --
> Gary
Excellent, thanks.
But that makes me wonder about the persistence of properties of the System
Events applcation; which in turn makes me wonder - can you tell System
Events to quit and if you do - and I assume you REALLY should not - will it
restart itself?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden