Apple Scripting - Automatic PDF printing

I have folder /Volumes/Data/pdf/ where generates invoice files (pfd)
I want them print default printer automatically.
Any ideas how to create script like that?

I think it should watch folder and when there is new pdf → it print that
after printing it should go subfolder /Volumes/Data/pdf/Printed/

Model: Mac Mini M1
Browser: Safari 605.1.15
Operating System: Other

This should work.
I didn’t test it but should be OK:

on adding folder items to this_folder after receiving these_items -- this_folder is an alias
	set subFolder to (this_folder as string) & "SubFolderName"
	repeat with aFile in these_items
		tell application "Finder"
			if aFile's kind is "PDF document" then -- check if is a PDF
				print aFile
				delay 1
				move (aFile as alias) to subFolder with replacing
			end if
		end tell
	end repeat
end adding folder items to

It does not enter into an infinite loop. Just tested, and it worked as expected. You trigger the infinite loop only if you change the name of the drooped file. But not if you move the file into a subfolder.
The “Folder Action” only monitors the folder where you drop your PDF. Then it triggers one run of the script, and move the PDF into a subfolder, which is NOT monitored.
At least on my Mac with Big Sur …

Identifying pdf files using Finder’s kind is not a good idea because this property is localized.
When an English system returns “PDF document”, a French one would return “Document PDF”.

It’s better to check the name extension (available thru Finder) or the type identifier (available thru System Events).

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 22 janvier 2021 18:48:53

Good point !