Solved

Printing from DOS progam to screen escape sequences in telnet session

Posted on 2014-12-15
10
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 20

Expert Comment

by:n2fc
ID: 40502147
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
ID: 40502391
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 20

Expert Comment

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

That should route your LPT1 output back to the      console...
0
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
LVL 6

Expert Comment

by:Rob G
ID: 40502695
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
 

Author Comment

by:3vz713
ID: 40503208
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 20

Expert Comment

by:n2fc
ID: 40503290
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
ID: 40503324
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
ID: 40508598
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:hdhondt
ID: 40554955
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

628 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