Solved

Printing from DOS progam to screen escape sequences in telnet session

Posted on 2014-12-15
10
303 Views
Last Modified: 2015-01-17
Here's the issue I've been struggling to solve: We've moved software from physical DOS machines to a Georgia SoftWorks telnet server running on Windows 2003 to run DOS programs remotely. It supports passthrough printing (print escape codes sent directly to the screen) and the logon script for the user includes the variable that specifies passthrough printing for the client.

The problem? The programs don't support passthrough printing! Yes, I could map LPT1 to local clients however the terminals are going to be accessed from remote locations that do not have print servers or other means of connecting the remote printer to the Windows server through net use.

Yes - there are easy ways of solving this, like using the native Georgia Softworks client to support printing. However, we MUST use Ericom PowerTerm (which interprets escape codes from the host) for terminal emulation and using the native client isn't an acceptable solution as it is missing many of the features we require.

For example, I've been trying to print from WordPerfect 6.2 and the print job disappears instantly after printing. There are no options to configure screen-based output.
From edit at the command prompt it comes up with an error box that it cannot open LPT1 when attempting to print.

Here's what I'm thinking needs to be done: Print to file, or redirect LPT1 to a file and have print jobs saved for later printing. A program or batch file (perhaps incorporating external software) needs to be written which will output the saved print files to the remote terminal using the proper escape codes, thereby allowing PowerTerm to handle printing. Another issue is that the program must run in the foreground, of course, so that PowerTerm can receive the escape codes. Having the user manually exit the current program and launch the print program is no big deal (and I'm pretty sure that's the only way this can be done). It's possible we might need some unix-based commands from the Subsystem for Unix applications to actually pass escape sequences properly rather than the built-in "echo" in Windows.

Any help in putting together this program is greatly appreciated, thanks a lot!
0
Comment
Question by:3vz713
10 Comments
 
LVL 19

Expert Comment

by:n2fc
Comment Utility
Are you trying to print to an actual printer from within the telnet session?

Try starting the DOS session with a "net use" command to access the printer on the server...

See:  http://pcsupport.about.com/od/commandlinereference/p/net-use-command.htm

Example: net use LPT1 \\{hostname}\{printername}
=============================

Sorry... Just re-read your problem statement & see you state you can't use "net use"...

Still confused by what you are trying to print on!
============================

Have you looked at this software?
http://www.dosprn.com/

It MIGHT help...   I think they have a free trial, so it's worth a shot to test in your system!
0
 

Author Comment

by:3vz713
Comment Utility
See that's the problem, I don't have a printer to print on. At least nothing that can be mapped over a network share like that as the printers are not accessible to the server hosting the terminal session.

I guess what I'm trying to do is print to screen - literally. I'm trying to take that spooled print file and have it directly output its information to the telnet session's screen. The only thing that is supposed to direct whatever is dumped to the screen to the printer is the escape code \033[5i preceding the printed text. The limitation when using Windows is having Windows actually interpret that escape code as an escape code and not just simple text that gets shown on the screen when you try to use the echo command in windows. In unix you can go "echo -e \n\033[5i [insert print job] \r\n\033[4i" and those characters would be invisible on the terminal screen but the printer would print that text.

I'm sure this can be done and I'm fairly good with programming batch files but I've never come across this kind of issue before and there isn't much info on exactly how to enter the escape sequences into a command so that they are interpreted properly in Windows.

This topic is fairly helpful in understanding what I'm trying to do:
http://yabb.jriver.com/ice/index.php?topic=840.0

In my case, Windows does not have a virtual folder or anything to print like that like Unix does.
0
 
LVL 19

Expert Comment

by:n2fc
Comment Utility
In the logon script, try using "net use" to map LPT1 to CON:

That should route your LPT1 output back to the      console...
0
 
LVL 6

Expert Comment

by:Rob G
Comment Utility
I wonder if you could simply just print it to a file and use a batch file to move the file elsewhere to print it to a physical printer. I assuming you would have a delay, but it should still work.

I am not familiar with the DOS emulator in which you are running through.
I use DOSBox internally here to virtualize dos, but i output prints to a text file then use a batch script to move them to a network share, and print them to a network printer. It's not hugely fast, but it does seem to work..

Theoretically..
If you did >c:\filename.txt instead of your print command it should write it local, unless you have an emulated filesystem. then you may have some issues doing this..
but then used a batch script to move the said files to a mapped drive off the 2k3 box, you should be able to then print them from that mapped location..
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:3vz713
Comment Utility
I do appreciate the suggestions but I think I should make it more clear, the print job MUST go to the screen in its final stages (i.e. visible to the terminal emulator (PowerTerm) but showing a blank screen for the user printing since the escape codes define what the user sees on the screen) for this to work - if Windows shares were accessible/possible then I would have no problem just printing directly to the printer, know what I mean?

I tried net use LPT1 from above but the problem is there is no "console" number, it is simply referred to as a process ID. There is no support for serial communications in the program, in fact there is no way of even knowing that you're running on a telnet session from the terminal, sort of like running cmd there is no console number, programs think they're running from a single user system.

The software runs directly out of Windows 2003's NTVDM with a few tweak programs (TameDOS) to ensure the DOS programs behave themselves but otherwise the filesystem is directly accessible to the user through the shell.

I'm thinking another option would be using a PowerShell script but that I'm completely unfamiliar with and still don't know if even that will let me send an escape character to the screen to cause a print job.
0
 
LVL 19

Expert Comment

by:n2fc
Comment Utility
I meant to literally use the command:
net use LPT1 CON:

Open in new window

... but apparently that is not a valid option...

Anyway...

Another program you might try to capture the output in DOS for subsequent streaming back to the console is here:
http://www.printfil.com/manualen/c7.htm

We'll keep on looking for things to try as long as you agree to try them and report results back!
0
 

Author Comment

by:3vz713
Comment Utility
n2fc, when I try that command exactly as typed, I get "System error 67, the network name cannot be found". The first time I tried it I did type it exactly as shown but I should have stated the full command rather than jut "net use LPT1" in my comment as it seemed like that's all I was typing in.

Now I think that it's possible Printfil will work as long as it can output to the screen - it supports sending escape sequences to the "printer" so it should work when sending escape sequences to the screen. It mentions telnet support but gives an example of it functioning similarly to just typing "net use ..."; in other words it will only print to mapped printers and not to the screen in that fashion.

I'll give it a try later tonight and see if it works.
0
 

Accepted Solution

by:
3vz713 earned 0 total points
Comment Utility
In short, Printfil does not work at all, even just attempting to print spits out garbage no matter what I tried.
I've resorted to saving as a file on a network share, then having Acrobat Distiller convert a postscript file into PDF which works fine.

Now, I've gotten somewhere as far as getting transparent printing to work. It involves using command.com and echoing (esc character)d# (for a Wyse 60) which actually starts a print spool session! That means we're getting somewhere. I haven't been able to get it to print anything yet as the spooler deletes file before anything comes out, but at least the terminal emulator is recognizing the characters.

I haven't had any time at all to work out all the commands yet but I figured I'd throw in a couple commands and see if I get anything and I'm happy to say it's working.
0
 
LVL 38

Expert Comment

by:Herman D'Hondt
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
Learn about cloud computing and its benefits for small business owners.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now