Dropzone 4 Add to Apple Notes Action

Does anyone know how to do Applescript to adda file to a new Apple Note upon dropping it on top of the Dropzone action? The below is not working.

tell application “Notes”
set newNote to make new note
repeat with thisFile in input
set noteBody to note body of newNote
set note body of newNote to noteBody & return & (POSIX path of thisFile)
end repeat
activate
end tell

Make sure to set your action to work on Dragged Files.

Use the following AppleScript.

# Files dropped on this action are placed in the draggedFiles list
repeat with i from 1 to number of items in draggedFiles
	set draggedFile to item i of draggedFiles
	
	# Set note name to name of the dragged file for this loop iteration
	tell application "Finder" to set |note name| to name of file draggedFile
	
	# Set the note content to be the name of the note
	set |note body| to "<body><h1>" & |note name| & "</h1></body>"
	
	# Create the note
	tell application "Notes"
		set |new note| to make new note with properties {body:|note body|}
		make new attachment at end of attachments of note named |note name| with data (file draggedFile)
		
		-- Workaround for Notes AppleScript bug on duplication of attachments
		delay 1
		tell note |note name|
			if ((count of attachments) > 1) then delete last attachment
		end tell
	end tell
end repeat

You can also optionally copy my icon or add your own if you prefer.

Optional: Icon Information

Copy the image below, open the action for editing, and paste it into the icon box in the top left as shown in the screenshot above.

Of course, if you are not bothered about the file name being captured and running in the background, you could just add an Open Application action and set it to “Notes.app”.

Hope that helps.