All I was asking is how can I find the Y with the numbers behind it. Not the X, G or F. I can write the rest and do the math once I have it. I just haven't found a way to efficiently locate it that's why we still use the old script with the sendkeys in it. I wasn't asking you to write it, just show me a better way of finding it. The math is not the issue. Here is the current script we are using.
;ARGUMENTS FOR MACRO CONVERTION OF Y MOVE TO A MOVEMENT
;This will use regular & replacement expressions through Texpad
disc=StrCat("For Y-(negative) moves change all Y's to positive now.Then change the A's back to negative after you have converted them.")
dia=IniReadPvt("con", "dia", "4.0", "C:\convertYtoA.dgn")
offs=IniReadPvt("con", "offs", "2.0", "C:\convertYtoA.dgn")
MyDialogFormat=`WWWDLGED,6.1`
MyDialogCaption=`Convert Y to A`
MyDialogX=-01
MyDialogY=-01
MyDialogWidth=254
MyDialogHeight=077
MyDialogNumControls=007
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,255|128|64`
MyDialogConfig=0
MyDialog001=`003,057,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`045,057,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`015,015,062,012,EDITBOX,dia,DEFAULT,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`001,007,092,012,STATICTEXT,DEFAULT,"OD or ID of part layout",DEFAULT,4,512,DEFAULT,DEFAULT,DEFAULT`
MyDialog005=`015,037,062,012,EDITBOX,offs,DEFAULT,DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog006=`001,029,092,012,STATICTEXT,DEFAULT,"Offset amount of tool",DEFAULT,6,512,DEFAULT,DEFAULT,DEFAULT`
MyDialog007=`111,007,126,064,VARYTEXT,disc,DEFAULT,DEFAULT,7,512,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("MyDialog")
offs =0%offs%
IniWritePvt("con", "dia", "%dia%", "C:\convertYtoA.dgn")
IniWritePvt("con", "offs", "%offs%", "C:\convertYtoA.dgn")
ClipPut("")
WinActivate("~TextPad")
SendKey("^{HOME}")
SendKey("^{a}")
SendKey("^{c}")
fn = ClipGet( )
SendKey("^{HOME}")
nt = ItemCount(fn,"Y")
nx=0
de=2
SendKey("^{HOME}")
While 1
Decimals(10)
nx=nx + 1
SendKey("{F8}")
ClipPut("")
ClipPut("Y\([0-9*]+\).\([0-9*]+\)")
SendKey("^{V}")
SendKey("{TAB 6}")
SendKey("{ENTER}")
SendKey("{TAB 4}")
SendKey("{ENTER}")
ClipPut("")
SendKey("^{C}")
a = ClipGet( )
rslt = StrCnt(a, "-", 1, -1, 0)
yy = StrClean(a, "Y", "", @FALSE, 1)
yy = StrClean(yy, "-", "", @FALSE, 1)
yt = %yy% + %offs%
yx = (57.296/(%dia%/2))
yt = %yx% * %yt%
yt = yt + 0.0
if rslt==1
yt="-"yt
endif
Decimals(3)
SendKey("{F8}")
SendKey("{TAB 1}")
ClipPut("")
ClipPut("A%yt%")
SendKey("^{V}")
SendKey("{TAB 6}")
SendKey("{ENTER}")
SendKey("{ESC}")
SendKey("{ESC}")
if nx == nt then break
endwhile
exit