That's not going to be as easy as you think. My best idea for how to do this goes like this:
1. Once you send the computer controlled hero a command, store the order id and the target location\unit whatever.
2. Start a timer for X seconds, during which, if the hero receives an order, send the order you stored again.
3. Once the timer stops/target has been reached, stop overriding methods received.
This is the basic outline. BUT, and you might want to allow some orders because some might be essential for normal unit action. And there are a lot of things to consider, like: aggro range and recurring orders, orders following your own walk order (might create something akin to an infinite loop), non immediate build and spell orders (including mana/resource refunding in case of order interrupts), and the effect of a stray unit on general AI behavior (might cause captains to act funky).
Sounds like an interesting experiment, and something someone probably tried doing already. I really suggest searching the hive for questions about this. If you want to try my way, go here for more info:
Orders repo
Missions (see mission 1 - order tracking)