×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Only Part of Screen is Copied

Only Part of Screen is Copied

Only Part of Screen is Copied

(OP)
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.

RE: Only Part of Screen is Copied

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).Value
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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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.

RE: Only Part of Screen is Copied

Quote:

I'll see if I can incorporate your code.

CODE

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

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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)

RE: Only Part of Screen is Copied

(OP)
I tried a few combinations and still I'm just getting one or two long strings printing out.

RE: Only Part of Screen is Copied

From Attachmate HELP

Quote:


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.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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

RE: Only Part of Screen is Copied

(OP)
No? Nothing else? : (
I'm flounderin ova' here

RE: Only Part of Screen is Copied

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied



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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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?

RE: Only Part of Screen is Copied

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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

RE: Only Part of Screen is Copied

(OP)
Oh wait! It's running now. Not sure if it's working, but its running.

RE: Only Part of Screen is Copied

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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Only Part of Screen is Copied

(OP)
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.

RE: Only Part of Screen is Copied

(OP)
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.

RE: Only Part of Screen is Copied

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close