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

Posted on Jan 9, 2019 6:04 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 12, 2019 1:17 AM

The solution, provided by MacScripter.net, was to alter this line:


set theFile to (("/Users/xyz/Desktop/ab_download/0" & imageCounter as text) & ".jpg"as POSIX file

Similar questions

1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript Notes App: Photo Attachments Not Visible

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.