×
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!

*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

cut and paste entire page in txt file

cut and paste entire page in txt file

cut and paste entire page in txt file

(OP)
How to copy entire page from sess0 and paste directlly in c:\mytxt.txt?

note:
during the process a press PF8 to go to the next page and i need to append to just part of page alreday copied into to txt file.

RE: cut and paste entire page in txt file

(OP)
sorry for up2thumbsup

RE: cut and paste entire page in txt file

something like this should get you started

CODE

Sub Main

        Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object
	Set Sys = CreateObject("EXTRA.System")
        ' Assumes an open sessions
	Set Sess = Sys.ActiveSession
	Set MyScreen = Sess.Screen
 
        Set MyArea = MyScreen.Area(1,1,24,80)
        
        MyFile = "C:\mytxt.txt"

        Open MyFile for Append as #1

            Print #1, MyArea
 
        Close #1  
    
End Sub 

look in the HELP files for "Open statement:description" for further information

RE: cut and paste entire page in txt file

(OP)
tK!!!!!
But the code write into txt all in one line!!!!!!!!!!!!

I need to paste into the txt exactlly wath i see in session...similar:

AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC
AAAAAAA BBBBBBBB CCCCCCC


And not in one line, similar:
AAAAAAA BBBBBBBB CCCCCCC AAAAAAA BBBBBBBB CCCCCCC

tkx!

RE: cut and paste entire page in txt file

be careful of what you ask for smile

Quote:

How to copy entire page from sess0 and paste directlly in c:\mytxt.txt?

something like this, maybe?

CODE

Sub Main
    Dim System As Object, Sess As Object, MyScreen As Object
    Set System = CreateObject("EXTRA.System")
    Set Sess = System.ActiveSession
    Set MyScreen = Sess.Screen
    
    MyFile = "C:\mytxt.txt"
      
    Open MyFile for Append as #1

        For i = 1 to 24
            
            MyArea = MyScreen.GetString (i,1,80)
            Print #1, MyArea
                
        Next i
        
    Close #1
    
End Sub 

RE: cut and paste entire page in txt file

(OP)
hi REMY988, tks!
The code now work great!

Sorry for my bad english (I'm Italian)

RE: cut and paste entire page in txt file

(OP)
Tks for code!
Now work great!

RE: cut and paste entire page in txt file

hi 2009luca,

no need to apologize. there are folks that would actually use the first code instead of the second. glad i was able to help you.

rem

RE: cut and paste entire page in txt file

(OP)
But in case to use the first how to read line by line the txt?

RE: cut and paste entire page in txt file

it can get complicated, depending on how the screens are structured.

when you scrape one entire screen, in this case (1,1,24,80), that means there are 1920 characters in total (80 characters per row * 24 = 1920).

then you can loop through the 1920 characters using the MID function

either way is just as quick. it's a matter of preference.

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! Already a Member? Login

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