AppleScript novice here. Trying to get some information from an image in Photos to populate some attributes in Tinderbox.
This is what I’ve got so far:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Photos"
set currentSelection to the selection
if currentSelection is {} then error number -28
--tell currentSelection
set PhotoCaption to description of currentSelection
-- set PhotoDate to date
set PhotoTitle to name of currentSelection
set PhotoFileName to filename of currentSelection
set PhotoID to id of currentSelection
--end tell
end tell
The lines commented out don’t make any difference. The script always returns the same error:
“Can’t get description of {media item id “7F30275C-031C-4E00-BFCB-FA8C49135A1D/L0/001” of application “Photos”}.”
The “description” property of a Media Item in Photos is the photo caption. If you comment out description, the next property fails as well.
You can get these properties if you place the photo in an album and do something like this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Photos"
tell its album "Blog"
tell its media item "Tomatillos"
set theDescription to description
set theTitle to name
end tell
end tell
end tell
tell application "Tinderbox 9"
tell note "blog" of front document
set value of (attribute named "Text") to theDescription
set value of (attribute named "Name") to theTitle
end tell
end tell
Mark Anderson did this for me, posted it at the Tinderbox Forum, and I’ve verified it works, but it’s not suitable for what I’m trying to accomplish.
I don’t wish to create a unique album and specify the photo by name each time, I think I should be able to just operate on the selection.
Clearly, there’s something I’m missing. Any thoughts?
Thanks,
Dave Rogers