printingprocessingautomatortexteditpage-setup

Using script or Automator to set page settings, margins and page wrap automatically on Text Edit files


I'm putting together an installation using Processing, where users type and their text is printed on a receipt printer. I've got Processing saving out time-stamped text files to a folder, and a folder action in Automator watching that folder and sending to print. My problem is that these .txt files need some intervention...

I think I have the margins thing figured out by adding some code to the file header on the Processing side. With the rest, I'm drawing a complete blank. I've tried setting the receipt roll as the default page size in 'Print and scan' in system prefs, but the receipt page size doesn't show in the list in system prefs, only shows on the page size list from within Text Edit application. I suppose what I'm asking - is there a way of setting TextEdit's default to page wrap, certain page size, certain printer - then a folder action can just print away (I hope). The idea is that these text files spit out of the receipt printer automatically with no intervention. Does anyone have any ideas? Thanks in advance.


Solution

  • Have you experimented with the settings available for TextEdit in AppleScript? If you look under the print settings section (in TextEdit's Script dictionary), there are a number of options available, which may help you achieve something pretty close to what you want. You could then drop the AppleScript into a Run AppleScript action in your Automator folder action.

    Alternatively, you could go completely nuts and design a template in Pages that meets your criteria, and then extract your text, paste into your Pages template, and print that out. A whole lot more work, but once it became functional, you would only need to change the Pages template in the future to meet changing needs.