before your code block that you are loading the g code with, put this:
if( !GetLED(67) ) //if OEM led for offline is NOT on
DoButton(178);//button press for putting mach offline.
//**** Your load g code, code here********
if( !GetLED(172) ) //G-Code is done loading LED.
return;
else
if( GetLED(67) ) //if OEM led for offline IS on
DoButton(178);//button press for putting mach back online again.
//advance to your next sequence, switch, or statement.
//scott