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!
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
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
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
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
Set Sess0 = System.ActiveSession
for each oSess in System.Sessions
if oSess.name <> Sess0.name then set Sess1 = oSess
next
....
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: How to copy from one session, paste in another
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
RE: How to copy from one session, paste in another
' 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