Folder Action Print Script

I got this folder action script from macosxhints.com that prints files dropped in a folder. The problem is, since this script uses /bin/lp, it apparently only prints .txt, rtf, pdf, jpg, tiff and a few other graphic formats. How do I modify it so it will print AppleWorks 6 files along with the others?


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
          tell application "Finder"
            display dialog "Error for item " & (this_item as string) ¬
             & ": " & error_message buttons {"Continue", "Cancel"} ¬
             default button 1 giving up after 120
          end tell
        end try
      end repeat
    end tell
  on error error_message
    tell application "Finder"
      display dialog error_message buttons {"Cancel"} ¬
       default button 1 giving up after 120
    end tell
  end try
end adding folder items to

I’m running OS 10.3.6 with Applescript 1.9.3 and AppleWorks 6.2.9. Let me know if you need any more information.

You’re right – lp only handles certain file types – the ones that darwin and CUPS can handle without any outside help.

If you want to add printing for any other application’s files, you’d need to tell the application to open the file, print it, and then save it.