Getting path in iPhotoLibrary by photo id using applescript

204 Views Asked by At

I try to select the path in the iPhotoLibrary of a photo by its id using the following Applescript:

tell application "iPhoto" set photoID to 25801 set thePhoto to photo id (photoID + 2 ^ 32) set photoPath to image path of thePhoto end tell

That doesn't work because Applescript told me, that it's not possible to convert 4.294993097E+9 to integer. I wrote (photoID + 2 ^ 32) as number and Applescript wasn't able to got the image path.

Please told me what was my mistake and how can I solve the problem.

1

There are 1 best solutions below

0
pbell On

You must first get the 'Photo' object from the ID by a search in iPhoto, then only get the path of that object:

set myPhoto to first item of (every photo whose id is myId)
set myPath to image path of myPhoto

myPath is the complete file path in Unix format (with'/' and not ':')