×
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

How to copy from one session, paste in another

How to copy from one session, paste in another

How to copy from one session, paste in another

(OP)
I've been using a macro (below) to copy and paste within the same session window, but I was wondering if it is possible to copy text from one session, and paste it into another session.

This is for Extra version 7.0 also, not the newest version if that makes a difference.

Here is what I use to copy and paste in the same session window:

' Selects the text, row column to row column
        Sess0.Screen.Select 7, 59, 7, 67
' Copy the text
        Sess0.Screen.Copy
    Sess0.Screen.WaitHostQuiet(10)
' Selects the place to paste, row column to row column
        Sess0.Screen.Select 18, 23, 18, 31                
'Paste the text
        Sess0.Screen.Paste
    Sess0.Screen.WaitHostQuiet(10)

Thanks!

RE: How to copy from one session, paste in another

you have to define your sessions

eg: Sess0 vs Sess1

if you record the macro, you will see how that works

RE: How to copy from one session, paste in another

(OP)
Ahhh, that gives me something to go on, and I see where they're defined.

Here's what the recorder used in the macro:

' 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

So I would add in the sess1 as an object, and the 'set sess# =' would be the name of the session window?  For example, if I had 'Session One', 'Session Two', etc...  I'd use 'Set Sess1 = "Session One"' or...

Well, I'll experiment and give that a shot.

Thanks

RE: How to copy from one session, paste in another

(OP)
Still can't figure it out...

How do i set up Sess1, Sess2, etc... in order to jump from one session to another?

I'm a newbie to this, so any help would be appreciated!

RE: How to copy from one session, paste in another




You have a Sessions collection...

CODE

    Dim Sess0 As Object, Sess1 as object, oSess as object
    Set Sess0 = System.ActiveSession

    for each oSess in System.Sessions
      if oSess.name <> Sess0.name then set Sess1 = oSess
    next
....

Skip,

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

RE: How to copy from one session, paste in another

the way i learned this was by recording from one session. type something into session 1
then click on session 2.
type something into session 2.
click back on session 1.
stop macro.
then review the macro...

 

RE: How to copy from one session, paste in another

How record a session1 ?

RE: How to copy from one session, paste in another

Here is an example


' 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 = 000        ' milliseconds

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

' Get the necessary Session Objects
    Dim Sess0 As Object
    SessName0$ = "SESSION1.EDP"
    
    Set Sess0 = Sessions.Item(SessName0$)
    If Sess0 is Nothing Then
        Err = MsgBox(SessName0 + " is not currently open.  Open it?",1)
        If 1 = Err Then
            Err = 0
            Set Sess0 = Sessions.Open(SessName0)
            If Err Then
                MsgBox("Failed to open " + SessName0 + ".  Stopping playback")
                Stop
            End If
        ElseIf 2 = Err Then
            Stop
        Else
            MsgBox("Failed to open " + SessName0 + ".  Stopping playback")
            Stop
        End If
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    
    Dim Sess1 As Object
    SessName1$ = "C:\Program Files\Attachmate\EXTRA!\Sessions\ENU\SESSION2.EDP"
    
    Set Sess1 = Sessions.Item(SessName1$)
    If Sess1 is Nothing Then
        Err = MsgBox(SessName1 + " is not currently open.  Open it?",1)
        If 1 = Err Then
            Err = 0
            Set Sess1 = Sessions.Open(SessName1)
            If Err Then
                MsgBox("Failed to open " + SessName1 + ".  Stopping playback")
                Stop
            End If
        ElseIf 2 = Err Then
            Stop
        Else
            MsgBox("Failed to open " + SessName1 + ".  Stopping playback")
            Stop
        End If
    End If
    If Not Sess1.Visible Then Sess1.Visible = TRUE
    Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
    
' This section of code contains the recorded events

        Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object
        Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.ActiveSession
    Set MyScreen = Sess.Screen
           Set MyArea = MyScreen.Area(5, 8, 5, 41)
        MyArea.Select
     Sess0.Screen.Copy
        Sess1.Screen.MoveTo 3,23    
        Sess1.Screen.Paste
        Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess1.Screen.Sendkeys("<Enter>")    
                
        AppActivate "SESSION2 - EXTRA! X-treme"
         
        Do While sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        
 
    System.TimeoutValue = OldSystemTimeout
End Sub
 

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