×
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

7.1a macro to select text?

7.1a macro to select text?

7.1a macro to select text?

(OP)
Hi guys,

I'm a newbie and a beginner when it comes to this stuff.  I'm using "myExtra Enterprise 7.1a." I need help writing a macro to select certain text in fields on my screen and copy it to the windows clipboard.  Where I will then past it into a word document.

My macro is below:

'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "SESSION1.EDP"
' Date: Thursday, March 15, 2012 18:32:34
' User: c59777
'--------------------------------------------------------------------------------

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

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

' 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
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    
' This section of code contains the recorded events
    
' Selects the text, row column to row column
        Sess0.Screen.SelectText 3, 19, 3, 43
' Copy the text
        Sess0.Screen.Copy
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

    System.TimeoutValue = OldSystemTimeout
End Sub



The section below I actually copy/pasted from another post on this forum:

' Selects the text, row column to row column
        Sess0.Screen.SelectText 3, 19, 3, 43
' Copy the text
        Sess0.Screen.Copy
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

The reason I did this is because I couldn't find a way to record the selecting of text on the screen.  Moving the mouse wouldn't record and pressing shift and the arrow keys also wouldn't record....

I need help trying to do this please!  Thanks!

 

RE: 7.1a macro to select text?

(OP)
To add: When I run the above macro I get an EXTRA!Basic Error msg box that pops up and says:
"No such property or method"
"Line number 50"
"Stopping macro playback."

The line 50 of my macro is: Sess0.Screen.SelectText 3, 19, 3, 43

which leads me to believe SelectText isn't the right command to use....

 

RE: 7.1a macro to select text?

CODE

Sess0.Screen.Select(3, 19, 3, 43).copy

from the help file

RE: 7.1a macro to select text?

(OP)
That one doesn't work either....hmmm.  I get the same error message when I copy and paste it in place of my wrong one.

"No such property or method"
"Line number 50"
"Stopping macro playback."

Thanks for the post though.  Any other suggestions?
 

RE: 7.1a macro to select text?

works for me.
post your code, please

RE: 7.1a macro to select text?

(OP)
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "SESSION1.EDP"
' Date: Thursday, March 15, 2012 18:32:34
' User: c59777
'--------------------------------------------------------------------------------

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

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

' 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
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    
' This section of code contains the recorded events
    
' Selects the text, row column to row column
        Sess0.Screen.Select(3, 19, 3, 43).copy
' Copy the text
        Sess0.Screen.Copy
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

    System.TimeoutValue = OldSystemTimeout
End Sub

RE: 7.1a macro to select text?

this is from the help file for 7.1
This example first copies the entire session screen to the Clipboard, then copies an area of the screen to the Clipboard.

CODE

Sub Main()
    Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object

    ' Invoke the clipboard viewer
    Shell("clipbrd.exe")

    Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
    Set Sess = Sys.ActiveSession

    ' This example demonstrates the Copy method for Screen objects.
    Set MyScreen = Sess.Screen
    MyScreen.SelectAll
    MyScreen.Copy

    MsgBox "The screen was copied to the clipboard. Press to copy a smaller area ..."

' This example demonstrates the Copy method for Area objects.
    Set MyArea = MyScreen.Area(1,1,10,10 , ,)
    MyArea.Select
    MyArea.Copy
End Sub

RE: 7.1a macro to select text?

this should work

CODE

Sub Main()

    Dim Sys As Object, Sess As Object
    Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.ActiveSession
    Set Sess = Sess.Screen
        sess.Area(3, 19, 3, 43).select
        sess.Area(3, 19, 3, 43).copy
        

End Sub

RE: 7.1a macro to select text?

(OP)
I bow to you sir; it works!  You're seriously awesome!  One last question to see if I can make the function even better.  Say I wanted to select certain areas:
(2, 18, 2, 23)
(3, 19, 3, 43)
(10, 8, 10, 13)

-like pressing ctrl and selecting seperate things on a web site.

Then I need to copy those areas to the clipboard all at once so that when I paste in a word doc, they will all be pasted.

Again, YOU are the man!

I found this help file you mention and see I have a lot to study now.

RE: 7.1a macro to select text?

check out copyappend method

CODE

    Dim Sys As Object, Sess As Object
    Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.ActiveSession
    Set Sess = Sess.Screen
 
        Sess.area(2, 18, 2, 23).Select
        Sess.CopyAppend
        
        Sess.area(3, 19, 3, 43).Select
        Sess.CopyAppend
        
        Sess.area(10, 8, 10, 13).Select
        Sess.CopyAppend

i learned this from
"http://www.tek-tips.com/viewthread.cfm?qid=1556664"
thanks to "link99: AttachMate solutions Linkssbc"

RE: 7.1a macro to select text?

But can these objects be compared to one another?  If so, how?

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