Scripting in Apple Aperture 1.0

Anyone try scripting in Apple’s new Aperture application?

Some things work very easily, like projects:


tell application "Aperture"
	activate
	set myProjects to name of every project
	set selectedProj to choose from list of myProjects
end tell

But I’m having problems with Albums. Even though I have a dozen albums, this code produces zero:


tell application "Aperture"
	activate
	display dialog "Albums: " & (count of every album)
end tell

I even tried this and get the same result:


tell application "Aperture"
	activate
	set myProjects to name of every project
	set selectedProj to choose from list of myProjects
	display dialog "Albums: " & (count of every album in selectedProj)
	-- or this, not sure if there's a difference:
	display dialog "Albums: " & (count of albums in selectedProj)
end tell

Anyone know how to get a list of Albums in Aperture? Thanks.

Ah, subtle difference. These things kill me.


tell application "Aperture"
	activate
	set myProjects to name of every project
	set selectedProj to choose from list of myProjects

	display dialog "Albums: " & (count of albums of project (selectedProj as string))
end tell