I have not tried it, but you could try inserting your script as the Event for the button, do what you want in your script, and then either have the original event as the Additional Event or try calling the event / bean method from your script via a webclientsession. That's where I would start looking.
------------------------------
Blessings,
Jason Uppenborn
Sr. Technical Maximo Consultant
Cohesive
------------------------------