INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- 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.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...These forums are an excellent source and example of the way people can help each other..."
Geography
Where in the world do Tek-Tips members come from?
|
7.1a macro to select text?
|
|
|
jfly25 (TechnicalUser) |
16 Mar 12 9:21 |
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!
|
|
|
jfly25 (TechnicalUser) |
16 Mar 12 12:09 |
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....
|
|
|
vzachin (TechnicalUser) |
16 Mar 12 21:29 |
CODESess0.Screen.Select(3, 19, 3, 43).copy from the help file |
|
|
jfly25 (TechnicalUser) |
17 Mar 12 12:28 |
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? |
|
|
vzachin (TechnicalUser) |
17 Mar 12 16:03 |
works for me. post your code, please |
|
|
jfly25 (TechnicalUser) |
17 Mar 12 23:15 |
'-------------------------------------------------------------------------------- ' 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 |
|
|
vzachin (TechnicalUser) |
18 Mar 12 8:37 |
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. CODESub 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 |
|
|
vzachin (TechnicalUser) |
18 Mar 12 9:34 |
this should work CODESub 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 |
|
|
jfly25 (TechnicalUser) |
18 Mar 12 13:33 |
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. |
|
|
vzachin (TechnicalUser) |
18 Mar 12 15:53 |
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" |
|
|
jonesy1 (TechnicalUser) |
11 Apr 12 19:30 |
But can these objects be compared to one another? If so, how? |
|
|
 |
|