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!

Only Part of Screen is Copied

Status
Not open for further replies.

jonesy1

Technical User
Feb 20, 2012
31
US
I'm using
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next....
to capture screen prints, but for some strange reason only 3/4 of the screen is captured. I don't know what to do to get it to pick up the entire screen. I tried messing with the row and maxcols, but to no avail.

Can someone please help?

Thanks.
 
hi,

How is MaxRows% assigned?

What is the actual VALUE of MaxRows%?

Also Area returns an OBJECT. You are assigning a STRING. Therefore, use the VALUE property, to be rigerously correct...
Code:
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)[b].Value[/b]
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10) 
Next
But why not...
Code:
screenbuf$ = Session.Screen.Area(1, 1, MaxRows%
, MaxColumns%, , xStream).Value
assuming that screenbuf$ is intended to be the contents of the screen.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
this is how its defined:

' 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%)

I'll see if I can incorporate your code.

Thanks for the response.
 
I'll see if I can incorporate your code.
Code:
' Initialize variables to hold screen information
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%[b]*MaxRows%[/b])

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
this didn't seem to work. It's just printing in one long string. Maybe with no carriage returns? is that what this is for? => Chr$ (13) + Chr$ (10)
 
I tried a few combinations and still I'm just getting one or two long strings printing out.
 
From Attachmate HELP
[tt]
Value Meaning

3 or xBLOCK The Area is selected as a rectangular range of characters. There is no line wrapping. This is the default.
2 or xSTREAM The Area is selected as a continuous stream of characters, from the top left coordinate to the bottom right coordinate. If the Area consists of more than one line, then the selection wraps to the right of each line.


Copyright 1996 - 1999, Attachmate Corporation. All rights reserved.[/tt]

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I tried changing xStream to xBlock and that still cut off half the screen;
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = Session.Screen.Area(1, 1, MaxRows%, MaxColumns%, , xBlock).Value
 
No? Nothing else? : (
I'm flounderin ova' here
 
This works for me...
Code:
    Dim sText As String, iMaxRows As Integer, iMaxCols As Integer, i As Integer
    
    Set oSystem = CreateObject("Extra.System")
    
    With oSystem.Sessions(1).Screen
    
        iMaxRows = .Rows
        iMaxCols = .Cols
        
        For i = 1 To iMaxRows
            sText = sText & .getstring(i, 1, iMaxCols) & vbLf
        Next
    
    End With
    
    Debug.Print sText

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


and this is even better...
Code:
Dim sText As String, i As Integer
    
    Set oSystem = CreateObject("Extra.System")
    
    With oSystem.Sessions(1).Screen
        
        For i = 1 To .Rows
            sText = sText & .getstring(i, 1, .Cols) & vbLf
        Next
    
    End With
    
    Debug.Print sText


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
to print, I was using:

filenum% = FreeFile
FileName$ = "H:\Projects\text file\REPORTS 6.txt"
Open FileName$ For Append as filenum%
Print # filenum%, screenbuf$; Chr$ (12)
Close filenum%

Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)

so I'm not sure where this ?(sText) is supposed to print. Should sText as referencing the location where I need to print?
 
I'm using my own variables. Don't like using old BASIC notation.

sText is simply a string variable just like your screenbuf$

Print it any why you like.
Code:
Print # filenum%, sText; Chr$ (12)
I was simply printing to the Immediate Window in Excel VBA. I ABSOLUTELY DETEST using Extra Basic.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Grrrrr! Now it's not running at all.

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Dim rc%, row%, MaxColumns%, MaxRows%, filenum%
Dim Screenbuf$, linebuf$, FileName$
Dim System As Object
Dim Session as Object

Dim sText As String
Dim iMaxRows As Integer
Dim iMaxCols As Integer
Dim i As Integer


Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim Screen As Object
Dim Sess As Object
Dim MyScreen As Object
Dim MyArea As Object
Dim counter As Integer
counter = 1

label1:
Set System = CreateObject("EXTRA.System") ' Gets the system object
With System.Sessions(1).Screen


If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions

If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 300 ' milliseconds
r_HostSettleTime = 5000 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Set Session = 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)

label:
' This section of code contains the recorded events
' Determine the size of the Presentation Space
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()
iMaxRows = .Rows
iMaxCols = .Cols

' Initialize variables to hold screen information
Screenbuf$ = ""
' linebuf$ = Space$ (MaxColumns%)
linebuf$ = Space$ (MaxColumns%*MaxRows%)
'--------------------------------------------------------------------------------------------------'


' This section of code contains the recorded events
Sess0.Screen.Sendkeys("<Clear>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime
Sess0.Screen.Sendkeys("axc<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)


If (counter = 1) Then
Sess0.Screen.Sendkeys("rc8099914<EraseEOF><NewLine><EraseEOF><NewLine>0531201205312012<Enter>")
Sess0.Screen.Sendkeys("<NewLine><NewLine><NewLine>V<Enter>")
ElseIf (counter = 2) Then
End If


Sess0.Screen.WaitHostQuiet(r_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf7>")
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.WaitHostQuiet(r_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf3>")

filenum% = FreeFile
FileName$ = "C:\Projects\Text fiele\OPEN REPORTS 4.txt"
Open FileName$ For Append as filenum%
Print # filenum%, sText; Chr$ (12)
Close filenum%

sText = ""
linebuf$ = Space$ (iMaxCols%)


if (counter >= 2) Then
System.TimeoutValue = OldSystemTimeout
Counter = 0
else
counter = counter + 1
goto label1
End If

End With
 
Oh wait! It's running now. Not sure if it's working, but its running.
 
You failed to use a With...End With reference for .Rows and .Cols!!!
Code:
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()

With Session.Screen
   iMaxRows = .Rows
   iMaxCols = .Cols
End With
But WHY ever assign iMaxRows & iMaxCols?

You ALREADY have MaxRows% & MaxColumns%!!!

You need to learn how to DEBUG your own code.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
You are correct. I'm not a pro at this, but it's pretty much what i read that you wrote so I added it to my code.

I'll get better with time.
 
I've used this site quite a bit in the past and have always been able to get my code up and running. This is the first time I've had this much of a difficult time.

You are right! My code is now a confused mess! It was working but apparently I must have made a mess of it.
 
I got this to work by doing:

For row% = 1 to 27
linebuf$ = Session.Screen.Area(row%, 1, row%, 132, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top