Printing a Text Field

I’m trying to figure out how to print the contents of a text view. I’ve set the contents of the view to “theOutputText” but I’m stuck as to how to print it. I’d like to have it display the printer selection dialog as well. Thanks.

Greetings.

While holding control, click on the button or menu item you want to control the print action and then drag to the text view and release. In the info window’s connections pane, select target > “print:”, and then hit the “Connect” button on the bottom of the info window to link it. That’s it! This will automatically bring up the print dialog and allow you to print, save to pdf, all the normal print features…and without any AS code.

Note…that you can not have both this connection AND an applescript handler connected to this control. If the control is currently calling applescript from one of your scripts, it will no longer work once you make the ‘print:’ connection. I recommend making a test app and playing with how any applicable objects print their contents using this method, as applescript has little support for printing and it may not produce the results you want. If something is out of place or not as you’d like, you’re pretty much out of luck as AS provides little (if any) flexibility. You may be better off finding a way in cocoa (seems like all the rage lately, anyways 8)).

A few of us were working on this a while back. I tried printing a bunch of different objects…so let me know if you have problems and I’ll shed what light I can. You can check out the beginnings of that discussion here… [url=http://bbs.applescript.net/viewtopic.php?t=8177]http://bbs.applescript.net/viewtopic.php?t=8177[/url]

Good luck…
j