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


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 " & quoted form of pFile
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .