Do you want to take a stab at writing the actionscript for this?
For reference, the following might help:
https://developer.bigfix.com/action-script/reference/execution/waithidden.html
Note that if it takes a long time to complete, rather than having the Client wait for the execution to finish, you may want to instead leverage the runhidden actionscript command.