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

Copy and Paste?

Status
Not open for further replies.

br2325

Programmer
Sep 24, 2002
4
US
need some help im pretty new at this but i need to "screen scrape" some information off a session in a certain place and then type it back out in the same session at a different place... i have the coords but don't know the exact syntax...or if there is a way to print the date in a session that would help also any suggestions would be helpfull
 
let me be a little more clear i am trying to copy some data from the screen of a session, then take that data and "paste" it back on the screen in a different place so this is what i have come up with...again dont have any idea what im doing...

Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Dim TodaysDate as Object
Set TodaysDate = Sess0.Screen.Select(1,54,1,58)
TodaysDate.Screen.Copy
TodaysDate.Screen.Paste
its way off but any insight would help
 
finally i got it i have never programmed in any laguages before other then in highschool some turbo pascal a lonng time ago here is some sample code that i came up with if someone has a better idea of doing this let me know:


' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------


' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim Col As Integer
Dim Row As Integer
Dim Screen as Object
Dim today as String



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 = 500 ' 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)
' Get the screen object
Set Screen = System.ActiveSession.Screen

' This section of code contains the recorded events
Row% = Screen.Row
Col% = Screen.Col
Sess0.Screen.Sendkeys("$$$")
Col% = Col% + 3
Screen.Row = Row%
Screen.Col = Col%
today$ = Screen.GetString (1, 54, 2)
Screen.Row = Row%
Screen.Col = Col%
Screen.PutString today$
Col% = Col% + 2
today$ = Screen.GetString (1, 57, 2)
Screen.Row = Row%
Screen.Col = Col%
Screen.PutString today$
Col% = Col% + 2

Screen.Row = Row%
Screen.Col = Col%

'Sess0.Screen.paste

Sess0.Screen.Sendkeys("02 req adpas snd 2076/bank pifty/cs bxr623")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

System.TimeoutValue = OldSystemTimeout


End Sub
 
Please help me how to write up a new Macro for logging in into the Session using a macro for the new release of Attachmate 6.6 version?
also I dont know how to write a code for pasting a repetative text in a program using a macro?
This attacmate always to use only VBSCRIPT.
Please suggest.
Thanks
 
This was a little challenging to me when I first started working on the copy/paste method in the same session.

' Copy a string of text from one location on the screen and paste in another location, within the same session

' Selects the text at Row 8 Column 14 through Row 8 Column 18
Sess0.Screen.Select 8, 14, 8, 18
' Copy MyText
Sess0.Screen.Copy
Sess0.Screen.WaitHostQuiet(100)
' Selects the text at Row 16 Column 41 through Row 16 Column 45
Sess0.Screen.Select 16, 41, 16, 45
'Paste MyText
Sess0.Screen.Paste
Sess0.Screen.WaitHostQuiet(100)

You first have to select the range you want to copy, then copy it. Once completed, you have to select the location where you want to paste it. The columns have to match, number of characters you copied.
 
How can I paste the information copied directly to a cell in Excel?.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top