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

Extra Basic Macro-Printing

Status
Not open for further replies.
Oct 4, 2002
4
0
0
US
We use many Extra Basic Macros on Attachmate 3270 sessions for scraping data, but recently have found a need to swap screens and run a "Print Screen" command to print each screen needed. In using the Sendkeys command to attempt to send a control key and a "P" key for bring up the print screen window it attempts to just write the data on the screen rather than actually sending the command so that "Enter" can be completed and thus printing the screen brought up. In using the helpfile I have tried numerous combinations that would compile, but not work as expected. Does anyone out there have any experience with this?? If so please advise, thanks!
 
This is what I use to print to a printer:

Code:
Sub Main()
Dim Sessions As Object
Dim Sess As Object
Dim Sess0 as Object
Dim MyScreen as Object
Dim System as Object

Dim rc%
Dim MaxColumn%
Dim row%
Dim MaxRows%
Dim filenum%
Dim Screenbuf$
Dim linebuf$
Dim FileName$

Set System=CreateObject("EXTRA.System")
Set Sessions=System.Sessions
Set Sess0=System.ActiveSession
Set MyScreen=Sess0.Screen

FileIn=FreeFile
'Takes a "snapshot" of current screen and stores it in variable Screenbuf$
MaxRows%=Sess0.Screen.Rows()
MaxColumns%=Sess0.Screen.Cols()
Screenbuf$=""
linebuf$=Space$(MaxColumns%)
For row%=1 to MaxRows%
    linebuf$=Sess0.Screen.Area(row%,1,row%,MaxColumns%,xBlock)
    Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Next
filenum%=Freefile
FileName$="\\Usiawloprn01\iaprnzesaq01" 'name of your network printer
Open FileName$ For Output as filenum%
Print # filenum%,screenbuf$ 'this actually sends the screen print to the printer
Close filenum%

End Sub

I am not sure what version we use for Extra Basic Macro but hopefully you can use some of this.

cew657
 
If you want, you may use a line like (see the end of the above example)

Print # filenum%,screenbuf$; chr$(12) 'this actually sends the screen print to the printer

where chr$(12) send a FormFeed to get out the paper.

mbars
 
Hi!

I have run into this printing issue before. Try this:

Sendkeys "%fp"
Sendkeys "{Enter}"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top