Got this to work on a Stepcraft atc.

'ToolChange Macro For Bed type tool changer 11/05 Brian (Butchered by novice)
Sub Main()
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
NewTool = GetSelectedTool()

'Tool Changer Macro (Bed Type)

MaxToolNum = 6 'Max number off tools for the changer
ToolDown = -67.1 'Z Pos to Get or drop a tool
ToolUp = -30 'Hieght to Rapid from tool to tool
ToolOut = -50 'Out off toolholder

If NewTool = OldTool Then
Exit Sub
End If


While NewTool > MaxToolNum
NewTool = Question ("Angiv værktøjs nr. op til " & MaxToolNum)
Wend

Code "G00 G53 Z" & ToolUp 'kører z i højde
While IsMoving()
Sleep 100
Wend
Call MovePos(OldTool) 'Move to toolchanger rack, offset from clip point
Message "Aflevere nuværnede værktøj"

While IsMoving()
Sleep 100
Wend
Code "G53 Z" & ToolDown
Message "Kører ned"
While IsMoving()
Sleep 100
Wend
Call ClipMove(OldTool) 'Old tool, clipping into the tool fork
Message "Kører ind"
While IsMoving()
Sleep 100
Wend
ActivateSignal(Output19) 'Spindle tool grip release
Code "G4 P2" 'Wait for the tool to release
Code "G00 G53 Z" & ToolUp
Message "Slip værktøj og køre op"
While IsMoving
Wend 'insert SystemWaitFor (4) 'Wait for the spindle tool sensor 1 SystemWaitFor (5) 'Wait for the spindle tool sensor 2
Call MovePosAct1(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown 'We are on new tool now
ActivateSignal(Output2)
While IsMoving()
Wend
DeActivateSignal(Output1) 'Spindle grips tool
Code "G4 P1.0" 'Wait for the tool to Clamp
DeActivateSignal(Output19)
Code "G4 P2" 'Wait for the tool to clamp
Call UnClipMove(NewTool)
While IsMoving
Wend
Code "G53 Y" & ToolOut
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )

'DeactivateSignal(Output3) ' dust boot down
'Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
Code "G00 G53 Z" & ToolUp
While IsMoving
Wend
Code "G49"
Sleep 100
Code "G43"

End Sub

'flytte til pos før aflevering kører ind i clips
Sub MovePos(ByVal OldTool As Integer)

Select Case OldTool
Case Is = 01
Xpos = 566.3
YPos = -50
Case Is = 02
Xpos = 542.25
YPos = -50
Case Is = 03
Xpos = 517.5
YPos = -50
Case Is = 04
Xpos = 492.8
YPos = -50
Case Is = 05
Xpos = 467.4
YPos = -50
Case Is = 06
Xpos = 443
YPos = -50
End Select

Code "G53 X" & XPos & "Y" & YPos

End Sub

Main

Sub MovePosAct(ByVal OldTool As Integer)

Select Case OldTool
Case Is = 01
Xpos = 566.3
YPos = -50
Case Is = 02
Xpos = 542.25
YPos = -50
Case Is = 03
Xpos = 517.5
YPos = -50
Case Is = 04
Xpos = 492.8
YPos = -50
Case Is = 05
Xpos = 467.4
YPos = -50
Case Is = 06
Xpos = 443
YPos = -50
End Select

Code "G53 X" & XPos & "Y" & YPos

End Sub

Main

'pos værktøj alle værktøjer
Sub MovePosAct1(ByVal NewTool As Integer)

Select Case NewTool
Case Is = 01
Xpos = 566.3
YPos = -10.6
Case Is = 02
Xpos = 542.25
YPos = -10.6
Case Is = 03
Xpos = 517.5
YPos = -10.6
Case Is = 04
Xpos = 492.8
YPos = -10.6
Case Is = 05
Xpos = 467.5
YPos = -10.6
Case Is = 06
Xpos = 443
YPos = -10.6
End Select

Code "G53 X" & XPos & "Y" & YPos

End Sub

Main

'aflever ind

Sub ClipMove(ByVal OldTool As Integer)

Select Case OldTool
Case Is = 01
Xpos = 566.3
YPos = -10.6
Case Is = 02
Xpos = 542.25
YPos = -10.6
Case Is = 03
Xpos = 517.5
YPos = -10.6
Case Is = 04
Xpos = 492.8
YPos = -10.6
Case Is = 05
Xpos = 467.4
YPos = -10.6
Case Is = 06
Xpos = 443
YPos = -10.6
End Select

Code "G53 X" & XPos & "Y" & YPos

End Sub

Main


Sub UnClipMove(ByVal NewTool As Integer)

Select Case NewTool
Case Is = 01
Xpos = 566.3
YPos = -50
Case Is = 02
Xpos = 542.25
YPos = -50
Case Is = 03
Xpos = 517.5
YPos = -50
Case Is = 04
Xpos = 492.8
YPos = -50
Case Is = 05
Xpos = 467.4
YPos = -50
Case Is = 06
Xpos = 443
YPos = -50
End Select



Code "G53 X" & XPos

End Sub

Main