Notes.app: Save notes's attachments at chosen folder.

No need to bother with GUI scripting like here: Save Notes attachment.

enjoy:


-- here I choose desktop folder, for example
set destinationFolder to (path to desktop folder) as text

tell application "Notes"
	set theAttachments to a reference to attachments of notes
	repeat with theAttachment in theAttachments
		try -- some notes have not attachments, so try block need
			save theAttachment in file (destinationFolder & name of theAttachment)
		end try
	end repeat
end tell

The script above saves all attachments of all notes of Notes.app.

Following version will save only the attachments of chosen (in Notes.app GUI) note:


on getNotesSelection()
	tell application "Notes"
		if ((count of windows) = 1) or (name of window 1 is "Notes") then
			if "4.7" ≤ its version then -- `selection` property not compatible before MacOS 10.15
				if (count of selection) = 1 then
					set noteID to «class seld» of (selection as record)
					set noteContainerID to «class seld» of ((container of note id noteID) as record)
					set selectedNoteName to name of note id noteID
					set selectedNoteFolderName to name of folder id noteContainerID
				else
					-- multiple notes selected
					return ""
				end if
			end if
		end if
	end tell
	return {note_Name:selectedNoteName, folder_Name:selectedNoteFolderName}
end getNotesSelection

set note_Name to note_Name of getNotesSelection()

-- here I choose desktop folder, for example
set destinationFolder to (path to desktop folder) as text

tell application "Notes"
	set theAttachments to a reference to attachments of note named note_Name
	repeat with theAttachment in theAttachments
		try -- some notes have not attachments, so try block need
			save theAttachment in file (destinationFolder & name of theAttachment)
		end try
	end repeat
end tell