• 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: Paul Skinner <email@hidden>
  • Date: Fri, 10 Aug 2001 10:14:34 -0400

on 8/10/01 9:40 AM, Adam Hinshaw wrote:

> Hi,
> im currently stumped with records.
>
> i want to be able to test that a property exists first before trying to set
> it.
>
> If its does not exists i will concatenate it to the record otherwise i want
> to add stuff to its value (another record)
>
> my current attempt as test (that is failing)
> -------------
> set x to {hello:"world", goodbye:"cruel world"}
>
> propertyExists(x, "hello" as data)
>
> on propertyExists(inRecord, theProp)
> --does a property:theProp exist in a record:theRecord
> set val to true
> try
> set test to theProp of inRecord
> on error
> set val to false
> end try
> return (val)
> end propertyExists
> ------------
>
> can any one see a way, (with out non standard osax ??)

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
--
"AppleScript is digital duct tape."
Paul Skinner


  • Follow-Ups:
    • Re: does property exists in a record
      • From: Adam Hinshaw <email@hidden>
References: 
 >does property exists in a record (From: Adam Hinshaw <email@hidden>)

  • Prev by Date: Re: does property exists in a record
  • Next by Date: Re: does property exists in a record
  • Previous by thread: Re: does property exists in a record
  • Next by thread: Re: does property exists in a record
  • Index(es):
    • Date
    • Thread