Hmm, that's weird, I played around a bit here and on my system I can't even turn ON the softlimits before I've homed/referenced the machine. Anyway, you could try something like this:
Code:
If GetOEMLED(23) Then 'Check if Softlimits are ON
DoOEMButton(1029) 'Toggle soflimits
End If
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
Code "G1 G53 X0 Y0"
While IsMoving()
Wend
If NOT GetOEMLED(23) Then 'Check if Softlimits are OFF
DoOEMButton(1029) 'Toggle soflimits
End If
/Henrik.