Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto printing line of text to LPT1 as received.

Status
Not open for further replies.

bedo43

Technical User
Feb 6, 2004
9
US
The Old PC has Procomm 2 installed on it and it is used as a secure card reader. Basically logging card use. The problem is the old PC (Text printer, Generic driver)will print the line of text as it is received on the screen. I believe the line print command is coming from the secure card CPU because I could not find any scripts on the Procomm 2. Trying to install a new PC with Procomm 4.7. works fine ,data appearing on screen but not auto printing. I can manually print and it works fine. Is a script required with the newer version of Procomm or is there a setting that will let the data appearing on the screen to print automatically? If script is needed is there a simple script and where would it go?

Thanks
 
If a script is not involved, then the only way Procomm will automatically print incoming text is if the remote system issues a dedicated print job. If the new machine is configured in the same way (terminal emulation would be the major thing to check) and it does not work, then you'll likely need to use a script as a workaround. Something like the below will take an incoming line of data and print it (minimally tested since I don't have a good testing environment at work):

proc main
string sLine

while 1
rget sLine 80 FOREVER
printer open
printstr sLine
printer close
endwhile
endproc

aspect@aspectscripting.com
 
Thanks Knob for the reply. Unfortunately I am not familair with scripts so I need to ask you again. Do I create/name this script in Aspect editor? if so then do I have to place it somwhere to run properly so it prints every line as it comes in. Apologize for the lack of knowlege with scripts...

Thanks
 
Yes, open the ASPECT Editor, paste the script above into it, and select the Tools | Compile menu item. You'll be asked where to save the file - you want it to go into the ASPECT directory under your Procomm install, which it should do by default.

One thing to keep in mind about the script above is that the incoming data will not appear on the screen since the rget command is intercepting it. We can workaround this if necessary by outputting the data to the screen after it has been received.


aspect@aspectscripting.com
 
Yes, I would like to be able to see it on the screen and have it print out also or vice versa. What part of the script would need modifying?

Thanks again!
 
I would have to test this further (getting ready to leave work), but I believe adding the line:

termwrites sLine

after the printer close line should do the trick.


aspect@aspectscripting.com
 
Knob,

Would like to resume discussion on this matter. Had to go out of town but now back. I inserted the script into Aspect and ran it . It did print the line of data correctly but then form feeded about two sheets. How do I adjust the print output to print line by line, no double spaces, no form feeds?

Thanks,
Dan
 
What kind of printer is this (i.e. tractor-feed or sheet-feed)? On my sheet-feed laser printer, the printer close command will complete the print job and the printout will appear, so you will only see one line per page in that case. If you are on a tractor-feed printer (I don't have one available to test), I do not know what Procomm will do there. You might try using "printer open raw", which the help file says will cause "all data to pass through to the printer, with no Line Feed, Form Feed, Tab or print attributes."

aspect@aspectscripting.com
 
Almost there! I have applied your suggestion and it now prints one line with no line feed as you stated. Only one line of data comes in at a time and it is printed to a Tractor feed simple dot matrix printer. Is there a way to make it line feed and then carraige return so the next line of data is printed without overtyping on the same line? Can control characters be inserted and read in the script?

Thanks
 
Yes, try adding this line:

printstr "`n`r"

after the printstr sLine command in your script (assuming what you have is similar to what I posted a while back). This will send a line feed and carriage return to the printer (hopefully!).


aspect@aspectscripting.com
 
The output to the printer seems to stop after two lines of data are printed. The script runner!? icon is still running but will not print when the next line of data comes in. Does this script have to be in this running state all the time to work and do are these scripts setup to run constantly or do they terminate after a certain period? I do not have any flow control setup on the printer as there was none with the older procomm setup. Any ideas?

Thanks
 
Sure, Here you go...

proc main
string sLine

while 1
rget sLine 80 FOREVER
printer open raw
printstr sLine
printstr "`n`r"
printer close
termwrites sLine
endwhile
endproc
 
Were you seeing this problem prior to adding the printstr "`n`r" line or before adding the printer open raw line (when you got just one line per page)?


aspect@aspectscripting.com
 
Well once I added the raw line it did print just one line but over each other. I only saw it print two or three times. I did not watch if it would have printed over itself more. Then I added the `n`r and it printed correctly twice and no more. I really did not notice if this was happening before the last two edits. When it was form feeding ,two prints, I did not let it print anymore because it was using up the paper so that is when you advised about the raw. Sorry not much help. Should I start from the begining?
 
Try commenting out the second printstr command and see what sort of results you get. If it still only prints twice, remove the raw argument from the printer open command and see what that does. I can't think of any reason why the script would only print two lines and nothing more.

aspect@aspectscripting.com
 
Thanks I will try it. Thanks for your help on this I appreciate your patience. I will be out for a few days after today and will let you know when I get back on Tuesday.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top