Batch printing using Applescript - no longer works

For several years I have been using a simple Applescript to monitor the contents of a folder, print new files then delete these files:

------

on adding folder items to this_folder after receiving added_items

repeat with each_item in added_items

tell application "AddPrinter" to open each_item

delay 30


tell application "Finder" to delete each_item

tell application "AddPrinter"

quit

end tell


end repeat

end adding folder items to

------

After the last Mavericks update it has stopped working and gives the error message "the document m3.txt could not be opened. AddPrinter cannot open files in the text format"


The same happens for PDF files - it seems that AddPrinter app has been changed and this functionality no longer works.


Is there some way to restore the previous AddPrinter functionality (I tried copying and using an old verison of the app, without success)?

Or is there another app that will work as intended?

iMac (27-inch, Late 2012), OS X Mavericks (10.9)

Posted on May 21, 2014 7:27 PM

Reply
2 replies

May 27, 2014 3:49 PM in response to Michael Paine

I have found an alternative to the AddPrinter.app that sort of works in this Macscripter tip from 2004:

http://macscripter.net/viewtopic.php?id=9835


do shell script "/usr/bin/lp '"

calls up the Unix print command (LP = line printer!)


This enables me to print .txt, rtf, pdf and jpg files


Here is the new script:

on adding folder items to this_folder after receiving these_items

try

tell application "Finder"

repeat with i from 1 to number of items in these_items

try

set this_item to item i of these_items

set the path_string to this_item as string

set the final_path to POSIX path of the path_string

do shell script "/usr/bin/lp '" & final_path & "'"

on error error_message

end try

delay 30


tell application "Finder" to delete this_item


end repeat

end tell

on error error_message

end try

end adding folder items to


Now I just need to find out how to do some minor formatting such as font size and margins...


Now digging into the CUPS manual:

http://www.cups.org/doc-1.1/sum.html

...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Batch printing using Applescript - no longer works

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.