×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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

CopyAppend in Attachmate

CopyAppend in Attachmate

CopyAppend in Attachmate

(OP)
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.

RE: CopyAppend in Attachmate

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 

RE: CopyAppend in Attachmate

(OP)
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.

RE: CopyAppend in Attachmate

Did you try the code I posted?

RE: CopyAppend in Attachmate

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

RE: CopyAppend in Attachmate

(OP)
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!

RE: CopyAppend in Attachmate

so this is good now?

RE: CopyAppend in Attachmate

Don't forget, "Great post? Star it!"

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: CopyAppend in Attachmate

(OP)
It is starred now! Again thanks, Remy - it was exactly what I needed and it works perfectly.

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