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

CopyAppend in Attachmate 1

Status
Not open for further replies.

Nightshade74

Technical User
Jan 14, 2013
5
0
0
US
I'm using Attachmate Extra! X-treme 9.1

I have a situation where I need to copy two pieces of information from a database to paste into another program, but where I have to make a decision as to which set of data (if at all) that I need.

What I am trying to do is have a single macro that will copy the first bit of data and then append the 2nd bit.

The copy portion is working just fine.

Sess0.Screen.Copy

But it is failing to append the second data piece

Sess0.Screen.CopyAppend

PS - There are only two pieces of data I have to choose between, so to keep it super simple my plan is to just have two separate macros - one to copy data set A and the other to copy B.

Any help would be appreciated.
 
Nightshade74,

not sure what your code is but give this a whirl for a test
Code:
Sub Main()

    Dim Sys As Object, Sess As Object, MyScreen As Object
    Dim MyArea As Object
    Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.ActiveSession

    Set MyScreen = Sess.Screen
    MyScreen.putstring "HELLO", 1, 1
    MyScreen.putstring "THIS", 2, 1
    MyScreen.putstring "IS", 3, 1
    MyScreen.putstring "A", 4, 1
    MyScreen.putstring "TEST", 5, 1
        
    Set MyArea = MyScreen.Area(1,1,2,5,,)
    MyArea.Select
    MyScreen.Copy
    MyScreen.Moveto 10, 2
    MyScreen.Paste
    Set MyArea = MyScreen.Area(3,1,5,5,,)
    MyArea.Select
    MyScreen.CopyAppend
    MyScreen.Moveto 20, 10
    MyScreen.Paste
        
End Sub
 
My code is very simple and that may be the problem.

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.QuickPads("TOP BAR").Visible = True
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Select 14,66,14,75
Sess0.Screen.Copy
Sess0.Screen.Select 6,13,6,73
Sess0.Screen.CopyAppend

The macro copies the first bit of info to the clipboard perfectly (14,66,14,75) but fails to append the second segment (6,13,6,73) to the clipboard.
 
the recorded macro does not work;

this will work
Code:
Sub Main()


    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")
    Dim Sess0 As Object
    Set Sess0 = System.ActiveSession
    Dim MyArea As Object

    Set MyArea = sess0.screen.Area(14,66,14,75,,)
    MyArea.Select
    sess0.screen.Copy

    Set MyArea = sess0.screen.Area(6,13,6,73,,)
    MyArea.Select
    sess0.screen.CopyAppend
    sess0.screen.Moveto 20, 10
    sess0.screen.Paste
        
End Sub

I'm not sure what you are doing after CopyAppend; I pasted the data into row 20, col 10
 
Thanks, Remy!!!

I tried to adapt the code in your original post to what I was trying to do (and failed miserably in the process).

This is exactly what I was needing!
 
Don't forget, "Great post? Star it!"

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
It is starred now! Again thanks, Remy - it was exactly what I needed and it works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top