I am not sure what your work flow is here. Would someone 'commit' the invoice and then send the email with the Invoice attached or would someone look up a particular invoice and then decide to email it? Many times you can control user actions by controlling the interface.
Much like controlling the display of information, you can control the display and use of buttons. If you 'hide' the email button until your invoice commitment is fulfilled, the user will not be able to click on the button. So you can use the Hide object when feature on the button that calls the email script. When the invoice is committed, set the condition that allows the button to be un-hidden.
If they are to commit the invoice and then send the email, in your script that commits the invoiced items, once the items are committed, you could use Show Custom Dialog script step. Set one button to Cancel and one to Send Email. Use Get(LastMessageChoice) function to test which button they click on the custom dialog. If they select Send Email either call that script or include the script steps in the commit records script.
Tnx a lot for your help. The hide object when option is working fine.