Goal: When a new file is added to a folder, an AppleScript kicks off to print the document, wait until it’s done, then remove the file from the folder.
How: using Auotmator, Hazel, or KM
Help needed: The following AppleScript is giving me syntax errors. I’m not skilled in AppleScript (nor any other language) to know where to fix it. I did use ChaptGPT for some help but this is as far as I’ve gotten.
Any help is appreciated!
on adding folder items to theFolder after receiving theNewItems
-- Get the list of new items added to the folder
repeat with theNewItem in theNewItems
-- Check if the new item is a document
if document file type of theNewItem is true then
-- Print the document
tell application "Finder"
print theNewItem
end tell
-- Wait for the document to finish printing
repeat while (printer status of default print settings) ≠ idle
delay 1
end repeat
-- Close the Print application
tell application "Print"
quit
end tell
-- Move the printed document to the Trash
tell application "Finder"
move theNewItem to trash
end tell
end if
end repeat
end adding folder items to