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!

Using macros to copy data using relative screen position.

Status
Not open for further replies.

Nightshade74

Technical User
Jan 14, 2013
5
0
0
US
I already make extensive use of Attachmate Macros created using keyboard capture, but I'm wanting to make it a tad more user friendly for copying.

Currently I manually copy the information I need prior to launching the macro, but I'd like to automate the select and copy process too. The problem is the position I need to copy is dependent upon my cursor position.

Specifically, I need to be able to copy columns 46 - 80 of the row 7 lines above my cursor position. I have nearly a dozen existing macros which would benefit from being able to copy a from a position relative to the current cursor position.
 
not sure if I have understood but see if this will help
Get your cursor poistion, on my screen its in the bottom right. eg 19/46 19 "rows" down 46 "columns" across.
7 lines above curser will be 12/46


'to get cursor position
dim curpo as string

curpo = .getstring(40,40,5) you will need to mess around with the numebrs to get them right
'to work what the row is
dim a as string
a = left(curpo,2) 'this should give you the row
' to work out 7 rows above
dim b as string
b= a-12


to copy the data you want

'target being the name of the string, 34 being from column 46-80
dim target as string
target = .getstring (b,46,34) '7 rows above cursor, 46 columns from the left, copy next 34 colums


this may not be exact but may help to get you going
smiler44

 
Hey

Maybe you mean something like this?

Code:
Dim cursor_position(1) As Integer
    
cursor_position(0) = Sess0.Screen.row
cursor_position(1) = Sess0.Screen.col

Then you got your position of your cursor.

Lakare
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top