Serious bug handling missing values with Snow Leopard

AppleScript seems to have serious problems dealing with missing values on snow leopard-- as it always tries to coerce the constant ‘missing value’ into the data type expected (text, date).

Now the same is true with Address Book. See this script:


tell application "Address Book"
	set cd to current date
	set this_year to year of cd
	try
		-- errors on snow leopard
		set birthday_peeps to every person whose birth date is not missing value
	on error
		-- works on snow leopard
		set jesus to current date
		set year of jesus to 0
		set birthday_peeps to every person whose birth date > jesus
	end try
end tell

The error on snow leopard is:

Address Book got an error: Can’t make missing value into type date." number -1700 from missing value to date

Similar to the one posted in the iCal bug I reported earlier:

http://macscripter.net/viewtopic.php?id=30261

I have reported both these bugs to Apple as bug # 7186603 (general missing value issues) and #7183170 (setting missing value in iCal).

Grrrr… It appears it is not only limited to missing value:


tell application "Address Book"
	set these_peeps to every person whose custom dates is not {}
end tell

error: Address Book got an error: Can’t make {} into type custom date." number -1700 from {} to custom date

Unlike the Jesus trick above… Can’t think of any other work around than to loop through every contact/person.