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

Caputring Data to a file using a macro

Status
Not open for further replies.

mytime21

Programmer
Apr 3, 2006
31
US
I have been able to record a macro that will run the report and stick it in the spooler for me. I need to be able to make the capture incoming data work while running a macro to be able to send the data to a file. I am a beginner in this. The data that goes to the file is variable and can range from about 20,000 lines to 30,000 lines. Can anyone help me to be able to capture the data from the spooler into a file using a macro???
 
strInfo is the date you're capturing.

Code:
Sub Main
  Open "C:\Temp\File.txt" For OutPut As #1
  Print #1,strInfo
  Close #1
End Sub

If you want to print it to word:
Code:
Const wdStory = 6
Const wdMove = 0
Const wdPageBreak = 7

Sub Main
  Dim objWord as Object, objDoc as Object, objSelection as Object
  Set objWord = CreateObject("Word.Application")
  Set objDoc = objWord.Documents.Open("C:\Temp\File.Doc")
  Set objSelection = objWord.Selection
  objSelection.EndKey wdStory, wdMove  'Moves cursor to end of file.
  objSelection.TypeText strInfo  'Inputs text
  objSelection.TypeParagraph  'Inputs return
  objDoc.SaveAs "C:\Temp\File.Doc"
  objWord.Close False
  objWord.Quit
End Sub

A couple things you might find useful if you go the word route.

To insert a page break:
objSelection.InsertBreak(wdPageBreak)

To show Word:
objWord.Visible = true
 
Here is what my current macro looks like. I have tried sticking in the first suggestion in different places and it only produces a blank text file of 1K. Any ideas???

'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
'--------------------------------------------------------------------------------

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
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 = 3000 ' 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
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
Sess0.Connected = True
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("vista<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("ma<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("spo<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("p<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("ryan mar<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("1<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Ctrl+M>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

System.TimeoutValue = OldSystemTimeout
End Sub

 
Your Macro is navigating only. It's never gathering any data from the screen object. This is why SKIE's example isn't working as you expect it to. The variable strInfo is supposed to be filled prior to writing the txt file.

These threads may help to get you started.

thread99-468324
thread99-541119

Following code should produce a one page txt file tittled C:\Temp\File.txt
Code:
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
'--------------------------------------------------------------------------------

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
        Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")    ' Gets the system object
    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 = 3000        ' milliseconds

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

' Get the necessary Session Object
    Dim Sess0 As Object
    Dim IRows, IColumns as Integer
    Dim StrInfo

    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
    Sess0.Connected = True    
    Sess0.Screen.Sendkeys("vista<Ctrl+M>")    
    Sess0.Screen.Sendkeys("<Tab>")    
    Sess0.Screen.Sendkeys("<Ctrl+M>")    
    Sess0.Screen.Sendkeys("ma<Ctrl+M>")    
    Sess0.Screen.Sendkeys("spo<Ctrl+M>")    
    Sess0.Screen.Sendkeys("p<Ctrl+M>")    
    Sess0.Screen.Sendkeys("ryan mar<Ctrl+M>")    
    Sess0.Screen.Sendkeys("1<Ctrl+M>")    
    Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Ctrl+M>")    
    Sess0.Screen.Sendkeys("<Ctrl+M>")    
    Sess0.Screen.Sendkeys("<Ctrl+M>")    

for IRows = 1 to Sess0.Screen.Rows
     StrInfo = StrInfo & Sess0.Screen.Getstring(IRows,1,Sess0.Screen.Cols) & Chr(13)
next row

Open "C:\Temp\File.txt" For OutPut As #1
Print #1,strInfo
Close #1
End Sub
If your trying to capture more pages you'll need a Turn Page function of some sort.

We can help you out with that with more info, does your screen scroll? do you get a page 001 of 003 or something similar in the footer of your page? Let us know if you need more help.



[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Here is what I've got:
Code:
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")    ' Gets the system object
    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 = 500        ' milliseconds

    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
        System.TimeoutValue = g_HostSettleTime
    End If
' Name the variables
Dim rc%
Dim MaxColumn%
Dim row%
Dim MaxRows%
Dim filenum%
Dim Screenbuf$
Dim linebuf$
Dim FileName$

' 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
        Sess0.Connected = True	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("vista<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("xxxxxx<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("xxxxxxxx<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("ma<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("spo<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("print<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("ryan mar<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("1<Ctrl+M>")	
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Keypad Enter><Keypad Enter><Keypad Enter>")	


        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

	System.TimeoutValue = OldSystemTimeout


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

filenum%=Freefile
FileName$ = "c:\temp\test.txt"
Open FileName$ for append as filenum%


For row%=1 to MaxRows%
    linebuf$=Sess0.Screen.Area(row%,1,rows%,MaxColumns%,xBlock)
    Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Write # filenum%, ScreenBuf$
Next
Close filenum%

End Sub
Only one problem: It prints out only the last parts of the scrolling screen. At first it was giving me a bunch of quotations, but after I changed the line Write # filenum%, "" to Write # filenum%, ScreenBuf%


ANy better ideas on how to make it capture the screen properly. THis screen is a scrolling screen and that just continues on until it reaches the end. Basically it is reading the spooled document onto the scren. I am trying to get it to append to a file as it reads it to the screen.
 
I have noticed that I never get the same data twice. I guess this may have to do with the scrolling.
 
you'll have to update the code for a scrolling screen. I don't have one but i'm assuming it will be something like this.

For scroll = TopOfScroll to BottomOfScroll
For row%=1 to MaxRows%
linebuf$=Sess0.Screen.Area(row%,1,rows%,MaxColumns%,xBlock)
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Write # filenum%, ScreenBuf$
Next
Next scroll

or this

While not end of Scroll
row% = row% + 1
linebuf$=Sess0.Screen.Area(row%,1,rows%,MaxColumns%,xBlock)
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Write # filenum%, ScreenBuf$
if this is the end then end of scroll = true
Wend


What I don't know is how to navigate your scroll or know when your at the end of it.

Do you use a key to advance through it a page at a time or is it a true scroll (new line at the bottom everything else rolls up one, dropping the top line)?

Do you get any type of on screen notification at the end (some type of footer ect.)?

The more you can tell us the better we can help.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
What do each of these do?

Sess0.Screen.Sendkeys("vista<Ctrl+M>")
Sess0.Screen.Sendkeys("xxxxxx<Ctrl+M>")
Sess0.Screen.Sendkeys("xxxxxxxx<Ctrl+M>")

I mean what does the <Ctrl+M> do? Scroll the page???

Or is that what your doing here with the page up???

Sess0.Screen.Sendkeys("ma<Ctrl+M>") Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Keypad Enter><Keypad Enter><Keypad Enter>")



[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
You might want to look at using it the Word doc way. That way, it'll just keep appending to the bottom of the document.

Code:
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Const wdStory = 6
Const wdMove = 0
Const wdPageBreak = 7


Sub Append2Word(strBuffer)
  Dim objWord as Object, objDoc as Object, objSelection as Object
  Set objWord = CreateObject("Word.Application")
  Set objDoc = objWord.Documents.Open("C:\Temp\File.Doc")
  Set objSelection = objWord.Selection
  objSelection.EndKey wdStory, wdMove
  objSelection.TypeText strBuffer    
  objSelection.TypeParagraph
  objDoc.SaveAs "C:\Temp\File.Doc"
  objWord.Close False
  objWord.Quit
End Sub

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")    ' Gets the system object
    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 = 500        ' milliseconds

    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
        System.TimeoutValue = g_HostSettleTime
    End If
' Name the variables
Dim rc%
Dim MaxColumn%
Dim row%
Dim MaxRows%
Dim filenum%
Dim Screenbuf$
Dim linebuf$
Dim FileName$

' 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
        Sess0.Connected = True    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("vista<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("xxxxxx<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("xxxxxxxx<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("ma<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("spo<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("print<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("ryan mar<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("1<Ctrl+M>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Keypad Enter><Keypad Enter><Keypad Enter>")    


        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

    System.TimeoutValue = OldSystemTimeout


'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%
    Append2Word(Sess0.Screen.Area(row%,1,rows%,MaxColumns%,xBlock))
Next
End Sub
 
what do you get with the following code on one of your scrolling screens?

Sub Main()
msgbox cstr(CreateObject("EXTRA.System").ActiveSession.Screen.Rows())
End Sub

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
THanks for the help. I am going to try some of this information out and see if I can get it to work. NOw for some answers to some questions:

"Do you use a key to advance through it a page at a time or is it a true scroll (new line at the bottom everything else rolls up one, dropping the top line)?"

No, It is a true scroll. It automaticall scrolls until it reaches the end then the macro proceeds to continue to run until is disconnects.

"Do you get any type of on screen notification at the end (some type of footer ect.)?"

No, See the SendKey aprt that say 0;240;99999 is to make it print in 240 columnar format to the screen.


"What do each of these do?

Sess0.Screen.Sendkeys("vista<Ctrl+M>")
Sess0.Screen.Sendkeys("xxxxxx<Ctrl+M>")
Sess0.Screen.Sendkeys("xxxxxxxx<Ctrl+M>") "

These actually are information that is an access code and verify code to sign into Attachmate. I just removed it a replaced it with X's so I would not be giving everyone my accesss and verify codes.

"I mean what does the <Ctrl+M> do? Scroll the page???"
I am not sure what this does, I think it may be the return key. WHenever I record the macro is shows up everytime at the end when I hit return."

"Or is that what your doing here with the page up???

Sess0.Screen.Sendkeys("ma<Ctrl+M>") Sess0.Screen.Sendkeys("<Keypad 0>;<Keypad 2><Keypad 4><Keypad 0>;<Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad 9><Keypad Enter><Keypad Enter><Keypad Enter><Keypad Enter>") "

This is the part in which it asks for a device to print to. I have the ability to make it print to the screen and it scroll through the report on the screen. Typically I would use the options-->Capture incoming data and then after typeing 0;240;9999999 I would hit return and it would begin scrolling through the report on the screen.

As it scrolls through the entire report on the screen I want it to capture into a file at the same time.

A more detailed explanation of what is happening: NEXT POST


 
Detailed explanation of what is happening.

I sign into vista with "VISTA".
then I enter Access code "XXXXXX".
followed by verify vode "XXXXXX".
I type "SPO" to get to the Spooler Menu
I then type "Print" to print a spooled document.
The computer then prompts me for the name of the document
to be printed.
I type "RYAN MAR", hit return and it selects the report.
The computer then prompts me for the number of copies
to print. I type "1".
The prompts me for where to print it to: This is where
I type 0;240;9999999 to make it print to my screen.

In order for me to capture this data I have to select the option Capture incoming data and then name a file I want it to be. I am trying to get around all of this and automate it.

Hopefully this detailed information will help.
 
The problem is this

'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%
Append2Word(Sess0.Screen.Area(row%,1,rows%,MaxColumns%,xBlock))
Next

is only going to grab the current rows on the screen after it does the scrolling. I don't have a scrolling screen so i'm at a loss as to how you account for it. If you place your cursor at the end of the scrolling screen does it give you an x,y anywhere (as in a row column or something else EOF)?

Does it manually allow you to print to file or just the screen?

Can you select the entire report with a cut and paste? If so a nasty work aroung could be sendkeys, select all then stuffing your text file with the paste.

Can you scroll back up once the report is loaded?

Sorry to ask so many questions, but I'm trying to help.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Change FileName$ to whatever folder and file name you want it to be and try this code. Let me know what ends up in that text file (if anything).

I cleaned up your code a little. There was quite a bit that didn't need to be in there. I'm also pretty sure you don't have to wait host quiet between your sendkeys.

Just a confirmation, Control+M is a carriage return.

Code:
Const HostSettleTime% = 500
Const eCR = "<Ctrl+M>"
Global g_szPassword$

Sub Main
    FileName$ = "C:\Temp\File.txt"
    Dim objSystem As Object
    Set objSystem = CreateObject("EXTRA.System")
    If objSystem is Nothing Then
        Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
        STOP
    End If

    Dim objSession As Object
    Set objSession = objSystem.ActiveSession
    If objSession is Nothing Then
        Msgbox "Could not create the Session object.  Stopping macro playback."
        STOP
    End If
    If Not objSession.Visible Then objSession.Visible = True
    objSession.Connected = True

    Dim objScreen as Object
    Set objScreen = objSession.Screen
    objScreen.WaitHostQuiet(HostSettleTime)
    objScreen.Sendkeys("vista" & eCR)    
    objScreen.Sendkeys("xxxxxx" & eCR)    
    objScreen.Sendkeys("xxxxxxxx" & eCR)    
    objScreen.Sendkeys("ma" & eCR)    
    objScreen.Sendkeys("spo" & eCR)    
    objScreen.Sendkeys("print" & eCR)    
    objScreen.Sendkeys("ryan mar" & eCR)    
    objScreen.Sendkeys("1" & eCR)    
    objScreen.Sendkeys("0;240;9999999" & eCR & eCR & eCR & eCR)
    objScreen.WaitHostQuiet(HostSettleTime)

    Open FileName$ For OutPut As #1
    For row%=1 to objScreen.Rows()
        Line$ = objScreen.Area(row%,1,objScreen.Rows(),objScreen.Cols,xBlock)
        Print #1,Line$
    Next
    Close #1
End Sub
 
is only going to grab the current rows on the screen after it does the scrolling. I don't have a scrolling screen so i'm at a loss as to how you account for it. If you place your cursor at the end of the scrolling screen does it give you an x,y anywhere (as in a row column or something else EOF)?

Yes. It gives and x,y coordinate.


Does it manually allow you to print to file or just the screen?
It only allows me to print to a screen manually and do a capture incoming data to the screen.

Can you select the entire report with a cut and paste? If so a nasty work aroung could be sendkeys, select all then stuffing your text file with the paste.
Yes, I just figured that out today that I can cut and paste the entire report by selecting everything and maximizing the history.

Can you scroll back up once the report is loaded?
See Above.

I am using Enterprise edition

Thank you guys for all the help.
 
So I did ont get much time yesterday at work to work this thing. But I worked on it some this AM and the exmaple that you gave me (SKIE), I cannot get it to compile.

It is not working as it gives me a bug report on the following line:

Line$ = objScreen.Arearow%,1,objScreen.Rows(),objScreen.Cols,xBlock)
 
Try

Line$ = objScreen.Arearow%,1,objScreen.Rows(),objScreen.Cols(),xBlock)

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Line$ = objScreen.Arearow%,1,objScreen.Rows(),objScreen.Cols(),xBlock)

Still does not want to compile. Same bugs on the following 2 lines:

Code:
        Line$ = objScreen.Arearow%,1,objScreen.Rows(),objScreen.Cols(),xBlock)
        Print #1,Line$%

Is there something missing after the "xBlock)" ???
 
Line$ = objScreen.Area(row%,1,objScreen.Rows(),objScreen.Cols(),xBlock)


[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
With your report printed to your screen open your macro editor and create a new macro like this

Sub Main()
msgbox cstr(CreateObject("EXTRA.System").ActiveSession.Screen.Rows())
End Sub

the purpose is I want to know if your Screen.Rows() value includes all of the rows in the scroll or just the number of rows the screen displays.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top