Applescript to hide print queue Running a Processing sketch which saves .txt files to a folder. Have a folder action attached that prints new files in this folder to a thermal receipt printer. 

However, I had to update to Yosemite, and since then the print queue window opens up over the sketch and has to be closed manually before continuing with the sketch.
When I print a document normally the printer proxy behaves and stays in the dock, and doesn't change focus from Processing.

I have no Applescript experience, but I think I need a script that I could include in the folder action, so these .txt files print automatically, without intervention while Processing is running.
One idea that comes to mind is to use the command line tools to print the files. If the files are sent to the printer without any pre-processing - in other words raw - then the following command should do it...

lp  somefile.txt - if your printer is the default

or

lp -d MyPrinter somefile.txt - for non-default printer

Use lpstat -a to get a list of printers and their Unix names.

From applescript you would have to do it this way...

set pFile to POSIX path of txtFile
do shell script "lp " &amp; quoted form of pFile