Benches macOS

1

AppleScript Notes App: Photo Attachments …

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

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

1 reply

Sign in or join Beachball Help to reply.

  1. 0

    Arkouda

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    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