We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Pages: 1 2 
printing (Read 4414 times)
printing
Apr 21st, 2008, 10:52am
 
I would appreciate some help with a particular topic.

I would like my application to print a randomly generated text over and over (not from a file) while the program is running, without opening a dialog window.

To those who might respond, thanks for saving my life.
Re: printing
Reply #1 - Apr 22nd, 2008, 4:50pm
 
Hector, that sounds like two things:

1) Generating random text
2) Displaying the text on the screen

For (1), do they have to be real words, real sentences?  Or do you just want gibberish, like "aoiw iowoivna poiasf!"

For (2), where should the text display?  (Presumably, somewhere within the Processing window.)  At what frequency?  Does new text overwrite/erase the old?

Some details about your intent would be helpful.
Re: printing
Reply #2 - Apr 23rd, 2008, 4:25am
 
Thanks for writing, Scott. I see that my first posting was not clear. I can generate the random text that I need. But I want to send the text to a physical printer (ie., not print to the screen). My ideal is that while some animation is running on the computer screen, the text will be printed simultaneously on a (preferably dot-mtarix) printer. The text itself is not to be displayed on the screen at all.
My aim is to print sequences of characters incessantly on a piece of paper without displaying those characters on the screen, without showing a printer dialog for the user to choose a printer, etc.
Sorry that this was not clear in my first posting.
I have looked at Java materials, but most of the examples depend on java.awt and are over-complicated for my purposes. Perhaps there is no way around that, but any pointers would be much appreciated.
Re: printing
Reply #3 - Apr 23rd, 2008, 4:13pm
 
Okay, that's makes more sense.  Thanks.

Unfortunately, I can't help you with this one.  I did do a project that involved printing, but it was one full page at a time to a laser printer.  Basically, on a user mouse click, I was generating an image (based on what was shown on-screen) and exporting that to a PDF.  Then, independent of Java, a Mac OS AppleScript would "watch" that folder, and whenever a new PDF appeared in it, the system would print it off.  There was no print dialog, which was my goal, too, but I don't know if this klugey hack would work for you.

If you do figure out a more pure solution, please post it here so we can all learn from it.
Re: printing
Reply #4 - Apr 24th, 2008, 4:04pm
 
printing on a dot matrix printer will depend on your printer.. usually it would be a case of using the serial library to talk directly to it and send commands for the printing.
Re: printing
Reply #5 - Apr 29th, 2008, 8:18am
 
thanks to both for your responses. i will try the suggestion and post what happens.
Re: printing
Reply #6 - Mar 30th, 2009, 9:36am
 
Hi,

I am having a slight problem with printing at the moment! I am tying to do something similar to what hector is doing..sending text to a printer from processing that is not being displayed on screen. I am wondering Hector did you find a solution to this?

Or is it possible to send a section of the screen to be printed rather than a full screen grab? Or even a save a section of the screen to a pdf?

Any advice on this or any information about printing using processing would be greatly appreciated.
Re: printing
Reply #7 - Jun 23rd, 2009, 3:30pm
 
@ Scott Murray

i am looking exactly for the printing solution you are describing in your last post.
i have a processing application running in an exhibition environment and i would like people being able to print out; just one file at a time to a laser printer...

if you have any hints on that apple script...
would be much appreciated!

best,
daniel
Re: printing
Reply #8 - Jun 23rd, 2009, 4:38pm
 
Daniel, I couldn't find the original AppleScript, but it's easy enough to recreate.  Open up Automator (in your Applications folder) and make a new script using the "Print Finder items" action.  Then I think you save it as a script, and drop it in ~/Library/Scripts/Folder Action Scripts/.  Then right-click the folder where your sketch will export its PDFs, and choose "Enable folder actions".  Somewhere in there, you indicate which script to run, and then anytime a new file "appears" in that folder, it will get handled by your script (which will print it).

Good luck!
Re: printing
Reply #9 - Jun 24th, 2009, 2:24am
 
dear scott, thank you very much for your quick and kind help!
will give that a shot. doesn't sound too complicated...  Wink

Re: printing
Reply #10 - Sep 9th, 2009, 8:24am
 
This question is for Scott (or anyone else who might know who to do this!)---Scott, I have a problem pretty much identical to TD's---I want to have a processing animation running in the gallery and viewers can click the mouse and print out the resulting pdf on the spot. All the within-processing stuff is working fine, but now I need to get the file to go automatically to the printer with no further user input. Your script sounds just right, BUT...
When I saved the script in the "Print Finder Items" action, it did not give me the option for a script extension---only "workflow" and "application". I tried just saving it as workflow anyway, but didn't work. All the other things in the "Folder Action Scripts" folder have script extensions.
Any ideas MUCH appreciated! BTW, I'm running Mac OS X 5.7
Re: printing
Reply #11 - Sep 14th, 2009, 4:00pm
 
In Automator, try Save As Plug-in > Plug in For > Folder Actions.
Re: printing
Reply #12 - Sep 16th, 2009, 12:55pm
 
Hey Scott---thanks so much for the reply. I have done as you suggested, but alas, no result yet. Apologies for woeful ignorance here---here's what I've done so far:

I saved the script (which contains only "Print Finder Items"---is that all it needs?); the system dumps it automatically in Library/Workflow/Applications in my home folder; then I went to the folder where I want the action to take place and enabled Folder Actions. Then I right-clicked again on my folder and then on "More" and then on "Configure Folder Actions." Then I got a little window labeled "Folder Actions Setup." On the left-had side of the window, I added (under "Folders with Actions") both the folder where the action should happen and the "Folder Action" folder. On the right-hand side, there then appeared the name of the script that should be used. (On both sides I checked the "on" box.)

Clearly, something is screwed up somewhere. Any ideas? Many thanks in advance. You actually had this thing working, right? I am envious...
Re: printing
Reply #13 - Sep 16th, 2009, 1:33pm
 
Try this:  After you right-clicked and chose "configure folder actions", you get a window with a split screen view.  On the top, make sure "Enable folder actions" is checked.  On the left, click the + sign, and select the folder you want to "watch".  Then you should be prompted to "choose a script to attach".  That script will be run every time a new item appears in your folder.  Hopefully, your new Automator script shows up here.  Click it, and click OK.

Then, back in split screen view, you should have your folder name highlighted on the left, and on the right, the name of the applescript that will run automatically.

If you follow those steps, do you get that far?
Re: printing
Reply #14 - Sep 17th, 2009, 7:04am
 
Yup---I get that far. And, in fact, there may be progress---this time when I keypressed to save a file from my animation, I saw the little Automator robot appear briefly on my toolbar. That seems like a good sign. But then no action from the printer. I checked to make sure that (a) the printer was on, and (b) there really was a new saved file in my directory. Yes and yes.
Pages: 1 2