• 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: How do you test if a property is empty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How do you test if a property is empty


  • Subject: RE: How do you test if a property is empty
  • From: Scott Babcock <email@hidden>
  • Date: Mon, 19 Jan 2009 15:42:48 -0800
  • Acceptlanguage: en-US
  • Thread-topic: How do you test if a property is empty

This won't work universally. I've found the following to be more robust:

try
    set current_val to (some_prop of some_obj)
    current_val -- trap undefined results
on error
    set current_val to missing value
end try

This works equally well for script properties:

try
    set current_val to (my some_prop)
    current_val -- trap undefined results
on error
    set current_val to missing value
end try


-----Original Message-----

Date: Mon, 19 Jan 2009 15:34:28 -0500
From: "Mark J. Reed" <email@hidden>
Subject: Re: How do you test if a property is empty
To: email@hidden
Cc: email@hidden
Message-ID:
        <email@hidden>
Content-Type: text/plain; charset=UTF-8

I believe something like this should work in general, not just for
iTunes tracks:

set current_val to the missing value
try
   set current_val to some_prop of some_object
end try

if current_val is the missing value then
   -- it wasn't set
else
   -- it was set
end if



On 1/19/09, Paul Taylor <email@hidden> wrote:
>
>> I realise when I originally tried this to do this I just compared to
>> 'missing' rather then 'missing value' , this seems to be the nearest
>> solution
>>
>> thanks Paul
> oops I meant 'neatest' solution
>  _______________________________________________
> 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
>
 _______________________________________________
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

  • Prev by Date: Re: How do you test if a property is empty
  • Next by Date: Re: Finder thru Safari
  • Previous by thread: Re: How do you test if a property is empty
  • Next by thread: Creating, modifying and formatting a pivot table with AS in Excel 2008
  • Index(es):
    • Date
    • Thread