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

Print Screen to File

Status
Not open for further replies.

clui

Technical User
Jul 13, 2007
1
US
I'm a newbie with macros in Attachmate. Does anyone know if you can print screen to a file, i.e., prn?

So far, I've gotten this but coming up with a lot of errors:

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

' This section of code contains the recorded events

Open "TESTFILE" For Output As #1
Print #1, sess0
Close #1

 

I think you have to pass the content of the screen to a string, then You can send it to a file:


Sub Main()

Dim Sys as object, Sess as object,Scr as Object
Dim s as string,row as long


Set Sys = CreateObject("Extra.System")
If Sys Is Nothing Then MsgBox ("Error"): End
Set Sess=Sys.ActiveSession
Set Scr = Sess.Screen


s=""
for row=1 to 20
s=s & Scr.GetString(row,1,79) & chr(13) & chr(10)
'79=size of a row
next row
's=content of the screen, suppose 20 rows X 79 columns

Open "testfile.txt" for output as #1
print #1,s
close #1

set Sys=Nothing
set Scr=Nothing
set Sess=Nothing
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top