Terry, Jason, 
This is related to the LoadRun topic - below is a little routine I've been using to sync up with the regen operation.
You may find this useful.
DoOEMButton(MachSimRoutine)
call WaitForSimFinish()   
Const RegenInProcessLED          = 179   ' On during regen & Sim process
Sub WaitForSimFinish()
   ' the call to start the mach SimRoutine is not synchrounous - in V3 it starts off a separate process that does the mach sim 
   ' this routine attempts to wait until the sim routine is finished.
   '
   ' ok this is an imperfect routine in that there is a potential timing hole.
   ' not much we can do since mach does not provide semaphores or locks for async operations.
   
   ' the "RegenLED" is supposed to be on while the regen (and Sim) operation is in process and then 
   ' it goes off when the process finishes.
   ' we wait for the LED to come on - that should mean that either
   ' a) the sim process is in progress, or
   ' b) the sim process finished before we had a chance to see it was in progress 
   ' then we wait for the LED to go off - that should mean the process is completed.
   
   'message "starting sim wait"
   While not CBool(GetOEMLED(RegenInProcessLED))
      ' process is not running, wait for it to start
      sleep(10)   ' we want at tighter loop here
      'message "waiting for led to go ON"
   Wend
   
   'sleep 10
   'message "waiting for end transition"
   'sleep 10
   
   ' ok the process started, wait for it to end
   While cBool(GetOEMLED(RegenInProcessLED))  
      ' wait for process to finish
      'message "waiting for sim to end"
      sleep(100)
   Wend
   Sleep (100)   ' add a bit of pad time
   'message "sim ended"
   
   ' ok, best we can tell, the process started and then ended, let's return to the caller
   Exit Sub
End sub