RE: How do you test if a property is empty
RE: How do you test if a property is empty
- Subject: RE: How do you test if a property is empty
- From: "Stockly, Ed" <email@hidden>
- Date: Mon, 19 Jan 2009 10:12:09 -0800
- Thread-topic: How do you test if a property is empty
It looks like your bigger questions have been answered, but here is a simple
answer to your original question:
>> How do you test if a property is empty?
It depends on the property, and they best way to find out is to ask the
property from a script and log the result. In some cases the result will be:
"" in others: {} and many (this case) it will be: missing value.
Here's an example:
-------
tell application "iTunes"
set myTrack to file track 4 of playlist 4 of source 1
log played date of myTrack
if played date of myTrack is missing value then
--do that stuff
else
--do that other stuff
end if
end tell
---------
Run this script with the log window open (and a reference to a track with no
played date, of course) and you'll see the missing value.
HTH,
ES
On 01/19/09 9:27 AM, "email@hidden" wrote:
> How do you test if a property is empty
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi how do you test if a property is empty, Im trying to copy a value
> from one object to another but its fail if the property has not been set
> in the original object , Ive tried variuos checks such as is empty, !=,
> is missing and none of them have worked
> (or compiled in most cases)
>
> if(played date of orig_track is not empty)
> set played_date_val to played date of orig_track
> set played date of new_track to played_date_va;
> end if
_______________________________________________
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