If you want to send script from a URCap when a program isn’t running, you can use a secondary client interface, as outlined in jbm’s post in this thread:
This allows you to send any URScript to the robot directly from within a ProgramNode, as opposed to script written in generateScript, which is only sent once you press play on the prgram.