How can I run a script outside the generateScript method?

I would like to execute a script when pressing a button in the installation node of my urcap, but what I understand is that the generateScript method only executes when a program is running, so, I would like to execute as I said a script when pressing a button without need of running a program. Could you give me some example codes? thanks

Take a look at this example:

Thanks I will try it and I will give feedback