Hi, first of all you have to load the script file on the device, the path depends on the script type:
- event scripts: /var/db/scripts/event
- commit scripts: /var/db/scripts/commit
- operational scripts: /var/db/scripts/op
Then you will have to activate the script, setting the command "set file <script-filename>" under the proper configuration hierarchy (which also depends on the script type):
- event scripts: [edit event-options event-script]
- commit scripts: [edit system scripts commit]
- operational scripts: [edit system scripts op]
Finally of course, you will have to commit to apply the configuration.
Note that one difference between the three kinds of script is how they are triggered: an event-script is triggered by an event policy, so you will also have to configure the statement "then event-script <event-script-filename>", followed by the script's (optional) arguments. Doing this, the script will be launched every time an event will match the policy. A commit script is triggered by a commit, and an op script by the operational command "> op <op-script-filename>"
I hope this helps you, I'd suggest you also to read some Juniper books on the argument, "This Week: applying Junos Automation" and the recently published "This Week: Mastering Junos Automation Programming".