Hi,
I am running a macro for a corner finder,
the type where the bit is dropped into a circle and it touches off on the sides and finds the center
which is the corner,
anyway when the macro is run the first time it runs backwards ( macro says to go left it goes right )
and does not stop when the tool touches the sides I need to hit the pause button to make it change direction.
after it runs the first time it works perfectly every time until mach is restarted, then the above needs to be repeated.
thanks for your help, I don't know if this is a mach issue or a macro issue....

this is the macro I am running:

Rem VBScript To center probe inside a circle


If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe plate is grounded, check connection and try again)"
Else
FeedCurrent = GetOemDRO(818) 'Get the current settings
XCurrent = GetDro(0)
YCurrent = GetDro(1)

Code "G55" 'Set offsets to G55
Code "G4 P2" 'Pause 2 second to give time to position probe plate
Code "F6" 'slow feed rate to 6 ipm

Rem Probe left

XNew = Xcurrent - 1 'probe 1 inches to left
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Wend
XPos1 = GetVar(2000) 'get the probe touch location

Code "G1 X" &XCurrent 'rapid move back to start point

Rem Probe right

XNew = XCurrent + 1 'probe 1 inches to right
Code "G31 X" &XNew
While IsMoving()
Wend
XPos2 = GetVar(2000)

XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G1 X" &XCenter 'rapid move to the x center location

Rem Probe up

YNew = YCurrent + 1
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos1 = GetVar(2001)

Code "G1 Y" &YCurrent

Rem Probe down

YNew = YCurrent - 1
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos2 = GetVar(2001)

YCenter = (YPos1 + YPos2) / 2

Rem move to the center

Code "G1 Y" &YCenter
While IsMoving ()
Wend

DoOEMButton (1008)
DoOEMButton (1009)
Code "G4 P1" 'Pause for Dro to update.


Code "F" &FeedCurrent 'restore starting feed rate
End If


thanks,
CMG