Sadly, as you can see, this is already overdue. I’ve gotten chunks of this to work, but something is eluding me. Here’s the script so far:
on run
tell application "Finder"
set sourceFolder to alias "Macintosh HD:Users:mftkoehler:Pictures:photos4K"
set targetPic to some item of sourceFolder
display dialog "I picked " & targetPic
tell application "Messages"
activate
set targetService to 1st account whose service type = iMessage
#send to self
set targetBuddy to participant "16501234567" of targetService
#set targetPic to alias "Macintosh HD:Users:mftkoehler:Pictures:Mia_cherry.jpg"
send file targetPic to targetBuddy
end tell
end tell
end run
I get the following error: error “Can’t make «class docf» "egk2 - 4.heic" of «class cfol» "photos4K" of «class cfol» "Pictures" of «class cfol» "mftkoehler" of «class cfol» "Users" of «class sdsk» of application "Finder" into the expected type.” number -1700 from «class docf» “egk2 - 4.heic” of «class cfol» “photos4K” of «class cfol» “Pictures” of «class cfol» “mftkoehler” of «class cfol» “Users” of «class sdsk»
I’ve tried a number of things to track down the problem. The script correctly picks a different file from the folder each time. If I uncomment the line that directly identifies the jpg, everything works. Somehow the file I select in the Finder is the incorrect type to pass on to iMessage. Help?