Why can't I get properties of a selected photo?

tell application "iPhoto"
	get properties of the front window
        -- a photo is selected in iPhoto
	set theselection to the selection
	get properties of theselection
end tell

the event log–

tell application “iPhoto”
get properties of window 1
{zoomed:false, closeable:false, resizable:false, miniaturized:false, document:document “iPhoto”, bounds:{6, 22, 1612, 941}, titled:false, floating:false, miniaturizable:false, zoomable:false, modal:false, class:window, name:“iPhoto”, id:73, index:1, visible:true}
get selection
{photo id 4.294984194E+9}
“Can’t get properties of {photo id 4.294984194E+9 of application "iPhoto"}.”

I don’t understand what is going on.

iPhoto/Applescript is responding OK – getting the properties of the window was just to see if things were working.
Why does trying to get properties of a selected photo fail? The same problem appears when trying to get any property of the photo – I was after the date.
It is the same with any photo.
If the photo ID is available, why are other properties not?

Model: iMac (intel)
AppleScript: 2.0
Browser: Safari 523.10
Operating System: Mac OS X (10.5)

Hi,
I think the reason your script’s not working is because

	set theselection to the selection

returns a list and then you’re trying to get the properties of the list rather than a list item!!
Try this:

tell application "iPhoto"
	set theselection to the selection
	repeat with this_selection in theselection
		get properties of this_selection
	end repeat
end tell

Thanks,
Nik

Hi and welcome,

selection in iPhoto is always a list, even if only one photo is selected
Try this

tell application "iPhoto"
	set theselection to the selection
	get properties of item 1 of theselection
end tell

Thankyou. :wink:

Stefan’s point about selections is worth remembering in most applications - selection usually returns a list even if only one object is selected.