A system and method for controlling a drilling rig, of which the method includes receiving a first message-based command from a supervisory system at a first gateway, determining a first system-specific command based on the first message-based command using the first gateway, and transmitting the first system-specific command from the first gateway to a first system-specific controller. The first system-specific controller is configured to execute the first system-specific command by controlling first rig equipment, but is not configured to execute the first message-based command.