Print Page | Close Window

Setting printer orientation.

Printed From: Rocket Software
Category: AccuTerm Knowledge Base (read only)
Forum Name: Green Screen
Forum Description: General terminal emulation questions
URL: https://forum.asent.com/forum_posts.asp?TID=1069
Printed Date: March 28 2024 at 6:46am
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Setting printer orientation.
Posted By: dynamic
Subject: Setting printer orientation.
Date Posted: June 28 2007 at 6:34am
Hi, I'm a noob evaluating AccuTerm for mvBase. A large complaint we have from our end users is having to print text documents to dot matrix printers. So far, AccuTerm has been able to print everything I have sent as a slave.

First, I was wondering if there is a way to have the software set printer orientation in graphics mode. I would like to be able to switch between a 80 column document (portrait) and a 132 character report without asking the end user to go into the tools.

On the same topic, is there a way to get a printer selection dialog, similar to the windows printer dialog when you hit File - Print in WORD?

Thanks for your help. I'll probably have more questions as I play with the software. So far, I like what I see.

Andy



Replies:
Posted By: bneylon
Date Posted: June 28 2007 at 8:26am
I "borrowed" some code from this post
http://www.asent.com/forum/forum_posts.asp?TID=1018
That'll give you a start on scripting, too.

Bruce


Posted By: dynamic
Date Posted: June 29 2007 at 1:02am
Thanks Bruce! I'll give it a try this weekend.


Posted By: PSchellenbach
Date Posted: June 29 2007 at 3:55am
Hi Andy -

The new release of AccuTerm 2K2 (5.3c - just out this week) has a new feature that might be helpful to you. We have added a feature called "print adapters", which are scripts that handle slave printer jobs. We are including two scripts that will send slave print jobs to a product called PrintWizard (www.anzio.com). One of the scripts will pop up the PrintWizard user interface where you can choose a printer, print to PDF, send PDF as email, etc.

To use this with PrintWizard, you need to purchase PrintWizard.

BTW: one of the benifits of using PrintWizard is the ability to send PCL-formatted forms and reports to pretty much any printer.

Thanks,

Pete


Posted By: dynamic
Date Posted: June 29 2007 at 8:04am
Thanks Pete. I have that version of AccuTerm and I downloaded an evaluation of PrintWizard. I haven't been able to get it to work yet (the printer tab in settings says PrintWizard is not installed.) But that's what Saturdays are for. No phones to bother me.

Andy

ETA: I got it to aloow me to set it up in the printers tab. I didn't load PrintWizard in it's default location. But when I print to it, it creates a tmp file. Like I said...Saturday.


Posted By: PSchellenbach
Date Posted: June 29 2007 at 10:06am
Hi Andy -

The Print Wizard adapter script looks for the printwiz.exe in the default location (C:\program files\printwiz30) and disables the choice if its not found. I think your best bet for working with a non-standard location is to make a copy of the two PrintWizard scripts, then modify them to look in the location where you have it installed. Also, return a different description so you can tell which one you are selecting. Here's an example (changes shown in red):

'<PrintAdapter>


'Print adapters are used by AccuTerm's slave print function to provide
'special print job processing. When an adapter is selected to handle
'slave print jobs, AccuTerm buffers the print job in a temporary file,
'then when the print job is closed, calls the adapter's ProcessPrintJob
'subroutine to process the job.

'
'----------------------------------------------------------------------
'

' PrintWizard Print Adapter

'This print adapter script is used to interface to Rasmussen
'Software's PrintWizard. It is designed to support PCL printing
'on non-PCL compatible printers. The PrintWizard "bang" commands
'can also be used to create PDF files, send the print job to a fax,
'or email the print job. See the PrintWizard documentation for more
'information.

'
'----------------------------------------------------------------------
'

'The Check() function is used by the print adapter configuration dialog
'to determine if a particular adapter is usable. The function returns
'True to indicate that the adapter is functional. The function should
'check if the required external application components are installed
'on the PC. For example, if the adapter uses a command line interface,
'check if the executable for the command is present.

Function Check() As Boolean
On Error Resume Next
Check = False
Path = "C:\Print Wizard\"
Cmd = Path & "PrintWiz.exe"

Check = FileExists(Cmd)
End Function

'
'----------------------------------------------------------------------
'

'The GetID(), GetDesc() and GetInfo() functions are used by the print adapter
'configuration dialog to associate the adapter with a particular ID number
'(GetID), provide a nice description of the adapter for use in the dropdown
'list (GetDesc), and return brief information about the adapter for use as a
'hint (GetInfo). GetInfo is optional.

'Note: print adapter IDs for user-created adapters should be above 100.
'Each adapter must have a unique ID between 11 and 9999.

Function GetID() As Integer
GetID = 11 'ID for PrintWizard
End Function

Function GetDesc() As String
GetDesc = "PrintWizard PCL Converter (custom)"
End Function

Function GetInfo() As String
GetInfo = "Use PrintWizard (Rasmussen Software) to process PCL print for use with any Windows printer. Also supports conversion to PDF, faxing and email."
End Function

'
'----------------------------------------------------------------------
'

'The ProcessPrintJob() subroutine retrieves the print job file name using
'the Command() function, then processes the file according to the adapter's
'function and design. If possible, the adapter (or command the adapter
'runs) should delete the file after processing. Any print job files remaining
'when AccuTerm closes will be deleted at that time.

'When creating your own print adapters, keep in mind that the Shell statement
'creates a new process to run the command, and then returns. You should not
'assume that the command has completed when the Shell statement returns. For
'this reason, if processing requires multiple commands to be executed in sequence,
'consider writing a .bat (batch) file, which you can launch using Shell.

'The PrintWizard adapter uses the PrintWiz.exe command to process the print
'job. A command line is formed and launched using the Shell statement. If
'the user has a specific printer selected (InitSession.PrinterName), it is
'passed to PrintWiz.exe as a command line argument. AccuTerm includes the
'"port" as part of the printer name - this must be removed before passing
'the printer name as a command line argument. The port is appended to the
'actual name with the word "on" between the name and port.

Sub ProcessPrintJob()
Dim Path As String
Dim Cmd As String
Dim Printer As String
Dim Filename As String
Dim k As Integer
On Error GoTo Fail
Printer = InitSession.PrinterName
Filename = Command$()
Path = Environ("ProgramFiles")
If Path = "" Then Path = "C:\Program Files"
Cmd = """" & Path & "\PrintWiz30\PrintWiz.exe"""
Cmd = Cmd & " /TRANSLATEPCL" 'translate PCL
Cmd = Cmd & " /Q 'no dialogs
Cmd = Cmd & " /D" 'delete file after printing
If Printer <> "" Then
k = InStr(1,Printer," on ")
If k > 0 Then Printer = Left$(Printer,k-1)
Cmd = Cmd & " /P""" & Printer & """" 'specify printer
End If
Cmd = Cmd & " " & Filename
Shell Cmd,7 'launch command in mimized window without activating
Fail:
End Sub


Thanks,

Pete


Posted By: dynamic
Date Posted: June 30 2007 at 2:26am

Hi Pete, Thanks for the info. I had already uninstalled and reinstalled PrintWizard. My problem now is that I am completely lost with this stuff. Before I went with PrintWizard, I was able to slave stuff to the default printer. I then used Bruce's help above to change printers and settings. When I went the next step to send stuff to PrintWizard, I got messed up.

All I did was check PrintWizard user interface on the printers tab of settings. The PrintWizard UI pops up, but it has a tmp file in the box and won't do anything. Do I need to add code to my program? Am I supposed to call a program? I've read Accuterm and PrintWizard manuals and FAQs. I thought I needed to add tags to the printout, but that didn't work. I'm not getting anywhere. Any help is appreciated.
 
Thanks,
 
Andy


Posted By: PSchellenbach
Date Posted: July 02 2007 at 2:47am
Hi Andy -

First, I had trouble with the PrintWizard UI when I first started working on this feature, and Rasmussen created a new version of pwui.exe that does work correctly. The problem was that pwui.exe would just print the job if a printer name was specified in the command. Now there is a command-line option that keeps the UI open and lets the user select printer options, pdf, email, etc. The version of the pwui.exe file that has the fixes is 3.0.60.1.

The post that Bruce is referring to is using graphics mode for the slave printer. The properties for setting orientation, paper size, etc. are only available in graphics mode. The Print Wizard adapter is its own "mode". PrintWizardPCL is mode 11, and PrintWizardUI is mode 12 (INITSESSION.SLAVEPRINTMODE = 12 in Peter G's sample code).

On my D3/Linux machine, I can use the Print Wizard UI by doing the following:

1) Make sure the slave printer is set to use the Print Wizard UI adapter in the Printer tab of the Settings.

2) In D3, at TCL, type SP-ASSIGN AS

3) Print a report (e.g. LISTU LPTR)

4) The Print Wizard UI should pop up about 5 seconds after the report finishes (you can adjust this timeout in the Printer tab).

5) To print the report on the printer selected in AccuTerm's printer tab, click the Printer icon from the Print Wizard UI toolbar. To open the printer dialog and choose a different printer or select printer options, use File->Print from the Print Wizard menu.

6) To send the report as a pdf attached to an email, click the Email icon on the Print Wizard toolbar.

7) To fax the report, click the Fax icon on the Print Wizard toolbar.

8) To save the report as a pdf file, click the PDF icon on the Print Wizard toolbar.

9) The temporary file holding the print job will be deleted when you close your AccuTerm session.

Thanks,

Pete


Posted By: dynamic
Date Posted: July 02 2007 at 6:41am

In mvBase we do:

AUX-ON
LISTPTR (P
 
If I do this with my printer setting set to Graphic, it prints a page to my default. If I do it with the setting set to Print Wizard User Interface, the UI pops up, but all the functions are greyed out. The file in the box is:
 
C:\DOCUME~1\asw\LOCALS~1\Temp\atwA68_000002.tmp
 
The number increases with each attempt. I have not loaded any Accusoft programs on to my mvBase system. Is that my problem? Or do I need to tell PrintWizard how to handle .tmp files? I'm guessing now.
 
Sorry about all of the questions. I really want to get this working. It could save me a huge rewrite onto a new platform. Thanks again for your help.
 
Andy


Posted By: PSchellenbach
Date Posted: July 02 2007 at 9:56am
Hi Andy -

Can you check the file version of the pwui.exe program? Use Windows Explorer to navigate to the C:\Program Files\Printwiz30 folder and right-click on pwui.exe, then choose Properties from the popup menu. Click on the Version tab. If the version is earlier than 3.0.60.1 contact Rasmussen and see if they will get you an updated version. If its higher than 3.0.60.1 let me know and I'll get an update from Rasmussen and check if something is broken in the newer version.

Thanks,

Pete


Posted By: dynamic
Date Posted: July 02 2007 at 11:58pm
Pete,
 
It's Version 3.0.58.0. I hope that's my problem. I spent hours playing with this thing. I didn't think it was THAT complicated. I'll let you know what I find. Again, thanks.
 
Andy


Posted By: dynamic
Date Posted: July 05 2007 at 1:44am
Hi Pete,

Rasmussen quickly got me 3.0.60.1, but I'm still having problems. I am still getting a .TMP file in the UI dialog box. The options under File are now active. If I try Print, Preview, or Generate a PDF, I get a message box that says Print by file type failed for file... and it shows the same file path. The email does work, but it sends the .TMP file. Do I need to set something in AccuTerm or mvBase that will change the file created to something other than a .TMP? Thanks again.

Andy

eta: It is not deleting the temporary files either.


Posted By: PSchellenbach
Date Posted: July 05 2007 at 4:02am
Hi Andy -

When working with Rasmussen on this feature, they told me that the Print Preview does not work with all files. The .tmp file is basically a .prn file which AccuTerm creates to store the contents of the print job. Everything that the host sent after the AUX-ON and before the AUX-OFF should be stored in that file, including all control characters & escape sequences. You might want to zip up one of the .tmp files and send it to Rasmussen to see if they can tell you why its not working as you expect.

The only reason the .tmp files would not be deleted when you close AccuTerm is if some other program had them open. Maybe pwui.exe was still running and had the file open?

Thanks,

Pete


Posted By: dynamic
Date Posted: July 05 2007 at 5:29am
Pete,

I didn't realize it was AccuTerm that deleted the file. I thought it was WinPrint. I emailed a copy of the file to Rasmussen. I really hope I get this thing working. I'll get a lot of pressure off of me.

Andy


Posted By: dynamic
Date Posted: July 05 2007 at 6:20am
Hi again, Pete. Rasmussen got me going. I had to uncheck "Smart Print" in the Edit menu of the UI. The option only appeared when I opened the UI from the Window's program menu. Bobby at Rasmussen said that they may need to tell WinPrint how to handle .tmp files. He also suggested that AccuTerm create a .txt file since WinPrint knows that file.

I think we have something here. Thanks for your help.

Andy


Posted By: PSchellenbach
Date Posted: July 05 2007 at 9:57am
Hi Andy -

I have been corresponding with Rasmussen about this, and they recommend adding a switch to the pwui.exe command to disable SmartPrint. If you want to add this switch you can open the PrintWizardUI.atsc script file in the AccuTerm Script window, then near the bottom of the script, change this line:
Cmd = """" & Path & "\PrintWiz30\PWUI.exe"" /interactive /kiosk"

to this:
Cmd = """" & Path & "\PrintWiz30\PWUI.exe"" /interactive /kiosk /smartprintoff"


Save the modified script.

Thanks,

Pete


Posted By: dynamic
Date Posted: July 06 2007 at 2:30am
Pete,

Your help has been invaluable. Once I get my reports (about 200 of them) updated to work with this, I can see a bunch of our end users buying AccuTerm and PrintWizard. If I could just get it to print a barcode I'd be all set. (I can dream can't I?).

Anyway, thanks for everything.

Andy


Posted By: PSchellenbach
Date Posted: July 06 2007 at 4:20am
You never know - PrintWizard might do bar codes too!

Pete



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net