AppleScript Notes App: Photo Attachments Not Visible
I am adding photos (from local) jpg files to a newly created Note.
The process seems to go OK: The note is created, the name added and I can see the (photo) counter increment, but no images appear in the note browser. They do appear in the attachments browser.
When I copy the note's contents to TextEdit, I see only the name followed by blank file icons.
Doing the whole process manually (creating and naming the note and dragging the files from the Finder) works as expected, so I can't determine what's causing a difference with AppleScript. Any ideas?
Here's the code:
tell application "Notes"
activate
set theNote to make new note in folder "AB" of account "On My Mac" with properties {name:"3038665"}
tell theNote
make new attachment at end of attachments with data "/Users/xyz/Desktop/ab_download/player.jpg"
repeat with imageCounter from 1 to 8
set theFile to ("/Users/xyz/Desktop/ab_download/0" & imageCounter as text) & ".jpg"
make new attachment at end of attachments with data theFile
end repeat
end tell
end tell
MacBook Pro