Please see Help > Scripting Index for a reference. Change the drop-down menu in the upper left to Objects, then select Fit Stepwise as shown here:
See the Direction, Enter All, and Go messages in particular. I suggest exploring more messages to see if there are any more that would be useful for your script.