Aperture 3 - path to referenced master image file
Can anyone supply a code sample to get the path to a referenced master image file in Aperture 3? I am using the file information to call EXIFtool in a shell script. The code below works for managed images, but not for referenced images. I put in the choose file dialog as a workaround.
on getPath(aItem)
tell application "Aperture"
tell library 1
tell aItem
set MasterFile to (get value of other tag "FileName")
set isReferenced to get referenced
if isReferenced then
set FinderPath to choose file MasterFile with prompt "Please locate referenced file"
set thePath to POSIX path of FinderPath
else
set ImpGroup to (get value of other tag "ImportGroup")
set MasterPath to my GetMasterPath(ImpGroup)
set MasterPath to my getLibPath() & MasterPath
set thePath to quoted form of (MasterPath & MasterFile)
end if
end tell
end tell
end tell
return thePath
end getPath
Thanks in advance.
on getPath(aItem)
tell application "Aperture"
tell library 1
tell aItem
set MasterFile to (get value of other tag "FileName")
set isReferenced to get referenced
if isReferenced then
set FinderPath to choose file MasterFile with prompt "Please locate referenced file"
set thePath to POSIX path of FinderPath
else
set ImpGroup to (get value of other tag "ImportGroup")
set MasterPath to my GetMasterPath(ImpGroup)
set MasterPath to my getLibPath() & MasterPath
set thePath to quoted form of (MasterPath & MasterFile)
end if
end tell
end tell
end tell
return thePath
end getPath
Thanks in advance.
iMac 27", Mac OS X (10.6.7), MacBook Pro