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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing from attachmate 6.5

Status
Not open for further replies.

bursland

Technical User
Mar 21, 2005
14
GB
We have just re-installed attachmate 6.5 onto our new pc's in the office .At the moment when trying to print to our network printer the attachamate session crashes .We can print ok from any other application and the running attachmate on our original pc's still prints ok
 
Sorry for the late response have been away on holiday. But yes you are absolutely correct. All our network printers ar HP Laserjet's .
 
I'm well familiar with this problem. The problem disappeared a few years ago when we got Lexmark printers. However, we were recently refreshed with HP printers and the problem has come back again. If you comb through Attachmate's website, they will tell you to upgrade to a newer version to resolve the problem. That’s nice of them. ;)

Here is what I do to get around the problem, so hopefully it will work for you as well. I simply open the .edp file in notepad and find "PsPrinterName=" and make sure it's set to the printer the user needs to use. It'll look something like:

Code:
PsPrinterName=\\fileserver\printername,winspool,Ne01:

Then find "PsUseDefaultPrinter=" and make sure it's set to 0.

Code:
PsUseDefaultPrinter=0

In my environment, if this is changed to 1, Extra will close out when you go to print. So this appears to be the source of the problem. And the reason for manually changing the printer is because it's hard to set the darn thing when Extra keeps closing out on you (if Use Default is checked and you uncheck it, it won’t save the changes when you click OK because it will crash).

Another method I use is a macro included with Extra, PRTSCR32.ebm. I modified it so that it will add the Username to the top of the printout (pulls the name entered in the edp file) as well as pull the printer and page settings from the .edp file (the location of the .edp file is specified in the macro). I just assign it to Control O.

Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'  MACRO NAME: PRTSCR32.EBM (update of 16-bit PRINTSCR.EBM - using OLE Automation)
'  WRITTEN BY: Attachmate Automation Support 
'DATE WRITTEN: 2/29/96
' DESCRIPTION: This macro prints the host screen for the Active Session Object.
'
'              Notes: You must set the FileName$ variable equal to the name of
'                     your Windows printer prior to running this macro.
'
'                     This macro will only run with EXTRA! 6.0 or greater. 
'
'              © Copyright 1989-1996.  Attachmate Corporation.  All Rights Reserved
'
'              This macro is provided as an example only and may need
'              to be modified to work in your environment.  It is 
'              provided as is, without warranty or support from
'              Attachmate Corporation.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Modified on 12/20/2001
'
' Added routine to obtain users settings from session file.  Added option 
' for landscape printing mode
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Declare Function GetPrivateProfileStringA Lib "kernel32" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer

Declare Sub InitVars()

Global inisect$      ' INI file section
Global ininame$      ' INI file name
Global username$
Global printername$
Global pageset$

Option Explicit

Sub Main

    InitVars
    
' Dimension macro variables and objects
    Dim rc%, row%, MaxColumns%, MaxRows%, filenum%
    Dim Screenbuf$, linebuf$, FileName$
    Dim System As Object
    Dim Session as Object
    
' Get the main system object
    Set System = CreateObject("EXTRA.System")
    If (System is Nothing) Then
        Msgbox "Could not create the EXTRA System object.  Aborting macro playback."
	Stop
    End If

' Get the necessary Session Object
    Set Session = System.ActiveSession
    If (Session is Nothing) Then
	Msgbox "Could not create the Session object.  Aborting macro playback."
	Stop
    End If

' Determine the size of the Presentation Space
    MaxRows% = Session.Screen.Rows()
    MaxColumns% = Session.Screen.Cols()
 
' Initialize variables to hold screen information
    Screenbuf$ = ""
    linebuf$ = Space$ (MaxColumns%)

' Copy the Presentation space
    For row% = 1 to MaxRows%
        ' Get a row of data from the host screen
        linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)

        ' Store the line read into screenbuf$
        screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
    Next
    
' Get the next available file number
   filenum% = FreeFile    

    FileName$ = printername$
    Open FileName$ For Output as filenum%

    If pageset$ = "Landscape" then
        Print # filenum%, Chr(27); "&l1O"
    End If
    
' Print Username at top of page
    Print # filenum%, "Username: " + username$ + Chr$ (13) + Chr$ (10)
    
' Print the screen with a form feed
    Print # filenum%, screenbuf$; Chr$ (12)

'Close printer
    Close filenum%

End Sub

Sub InitVars
'*************************************************************
' Gather username, printer and page orientation from session
' file..
'*************************************************************
    Dim INIdefs$, Buffer$
    Dim x%, strngchk%, SpcPos%
    inisect$="Session"
    ininame$="h:\extra\tcphost.edp"
    
    INIdefs$=""
    x%=254                        ' Space for the buffer
    Buffer$=space(x%)             ' Create the buffer
    x% = GetPrivateProfileStringA(inisect$,"PsDocumentName",INIDefs$,Buffer$,x%,ininame$)
    username$=Buffer$
        
    INIdefs$=""
    x%=254                        ' Space for the buffer
    Buffer$=space(x%)             ' Create the buffer    
    x% = GetPrivateProfileStringA(inisect$,"PsPrinterName",INIDefs$,Buffer$,x%,ininame$)

    'Determine if printer is local or network
    strngchk% = InStr(1, Buffer$, "\\")
        If strngchk% Then
            SpcPos% = InStr(1, Buffer$, ",")           ' Find comma.
                If SpcPos% Then
                    printername$ = Left$(Buffer$, SpcPos% - 1) ' Get printer name.
                End If
        Else
            printername$ = "LPT1"
        End If
        
    INIdefs$=""
    x%=254                        ' Space for the buffer
    Buffer$=space(x%)             ' Create the buffer
        
    x% = GetPrivateProfileStringA(inisect$,"PsOrientation",INIDefs$,Buffer$,x%,ininame$)

    pageset$=Buffer$

End Sub

My environment is using 3270 connections and HP LaserJet printers with Post Script drivers. I'm curious to know if this resolves your problem as well.
 
Thanx for the detailed reply I will be back in the office next week and will give it a go thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top