Re: Records
Re: Records
- Subject: Re: Records
- From: Luther Fuller <email@hidden>
- Date: Thu, 3 Nov 2005 14:55:13 -0600
1.
Mark J. Reed replied ...
Vertical bars are used to prevent names from being interpreted as dictionary
terms; useful if you have a variable whose name is the same as an item in
some application's dictionary, for instance. So I guess the point of using
them in a record property name is to avoid having a record property be
compiled one way where set and a different way where queried later. Which
doesn't explain why the compiler is stripping them.
I have since found that vertical bars are not always stripped. I just haven't
yet found which context strips and which does not. What I really need is a
reference to a document that explains this.
2.
As fo deleting an item from a record ...
Mark J. Reed replied ...
But, unfortunately, there's no way that I know of to delete a property from
a record value. You can add new properties, and you can modify properties in
I was afraid that would be the case.
place (so maybe setting n's a to the missing value is good enough for what
you're trying to do?), but you can't delete them.
The only way I know of (but me no expert) to accomplish what you're trying
to do requires enumerating all of the properties you *do* want to keep.
Something like this:
set n to {b: r's b, c: r's c, d: r's d,...}
where you just leave a out of the list.
But this won't work since I only know the name of the item I want to delete.
I'm doing this in System Events with an Info.plist file. I tried reading the
contents as a property list, then creating a new property list
without the offending
item. This works, but then I can't convert the new property list to a record.
The strange thing is, I can convert the original property list to a record with
something like ...
tell application "System Events"
set x to (contents of property list file f)
-- x is class plii
set y to (value of x)
-- y is class record
But this will not work with a property list constructed using
repeat ...
...
make new property list item at end of ...
...
end repeat
System Events scripting is very flakey.
BTW. I asked recently why a System Events script was interferring with another
stay-open script. Answer: Never tell System Events to display dialog.
You have to write ...
tell application "System Events"
...
tell me to display dialog ...
...
_______________________________________________
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