To do stuff like that I look at the screen is the designer and get the codes from the screen
For example:
if(GetOEMLED(23) then
'This code will run IF the softlimits are on...
end if
DoOEMButton(119) 'This will change the state of the softlimits
That should do it