• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: does property exists in a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: does property exists in a record


  • Subject: Re: does property exists in a record
  • From: Bryan <email@hidden>
  • Date: Sun, 12 Aug 2001 04:10:58 -0400
  • Organization: Apex Radiology

Good Lord!
Where did you get this information Neal?
Was this something documented somewhere,
or did you cobble together the command line:

{class:reference,<<class form>>:<<constant
****usrp>>, <<class want>>:<<class prop>>,
<<class seld>>:propname,<<class from>>:target}

I would greatly like to know the source of this;
and is there more?

Bryan Kaufman


"Neal A. Crocker" wrote:

> play with the script I've included at the end of this message. you
> ought to be able modify it to produce a script that generates
> references to record fields from strings containing field names.
> Such references can be created even for fields that don't exist.
> Trying to get the contents of a non-existant record field using a
> reference to it will, of course, generate an error. You can use a
> try block, much as you've done in the "propertyExists" handler in
> you original post, to catch that error and do whatever is necessary
> for a non-existant record field.
>
> When playing with the script I've included, be sure to read the
> comments in the script. It's tricky to compile. Also, the <<
> and >> characters represent chevrons.
>
> Neal.
>
> >Date: Sat, 11 Aug 2001 00:33:51 +1000
> >Subject: Re: does property exists in a record
> >From: Adam Hinshaw <email@hidden>
> >To: <email@hidden>
> >
> >on 11/08/01 12:14 AM, Paul Skinner at email@hidden wrote:
> >
> > > I would just look for it. If it's not there then add it.
> > >
> > > --begin script
> > > set x to {hello:"world", goodbye:"cruel world"}
> > > try
> > > hello of x
> > > on error
> > > set x to x & {hello:"world"}
> > > end try
> > > --end script
> >
> >problem is the property names i will be searching for are not constant.
> >They come from strings and will vary.
> >
> >is there a way then to coerce a string to a record property ??
> >
> >doesn't look like it at the moment.
> >
> >adam.
>
> The script below uses << and >> to represent left and right (or is it
> right and left) chevrons (Option-\ and Shift-Option-\). Watch for
> line wrapping.
> ______SCRIPT_______________
>
> on makereference(propname, target)
> script refscript
> --{class:reference,<<class form>>:<<constant
> ****usrp>>, <<class want>>:<<class prop>>, <<class seld>>:propname,
> <<class from>>:target} -- precompiled version of line below
> {class:reference, <<class form>>:<<constant
> ****usrp>>, <<class want>>:property, <<class seld>>:propname,
> from:target} -- this line will not compile. must uncoment line above
> and remove this line. save copy of commentented line above for
> future recompilation.
> end script
> run script refscript
> end makereference
>
> set blah to makereference("bar", {bar:2})
> {blah, blah + 1} -- {bar of {bar:2}, 3}
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Follow-Ups:
    • Re: does property exists in a record
      • From: "Neal A. Crocker" <email@hidden>
References: 
 >Re: does property exists in a record (From: "Neal A. Crocker" <email@hidden>)

  • Prev by Date: Re: apply catalog info
  • Next by Date: Re: formatting AS source for web
  • Previous by thread: Re: does property exists in a record
  • Next by thread: Re: does property exists in a record
  • Index(es):
    • Date
    • Thread