PRO Common Infrastructure
Resolves Incident Number
Added a new index function ExecuteScript, which could be used to execute a script function on specific condition:
The syntax of this function is: function=ExecuteScript, parm=(ScriptFileName, [ConditionKeyWord [,value] [,argument1_to_script_file ... argumentn_to_scriptfile] ]) while everything enclosed in '' is optional, for now the ConditionKeyWord could be select from 'TRIGGERFOUND' or 'TRIGGERNOTFOUNF', and it may need to be extended later.
Because for Field statement in FAPA mode trigger parameter is always required, so when you need to call a script function whenever a trigger is fired, you could set the trigger that you need to check as the trigger parameter in Field command, so the Trigger/Field statements in this case looks like:
TRIGGER NAME=everypage, VALUE=', POS=any, MODE=FAPA;
Field name=f_script,mode=fapa,trigger=everypage,function=ExecuteScript,parm=(settray [argumens] );
This will execute the script function settray whenever trigger everypage is fired.
Or: when you need to execute a script file whenever a trigger other than the trigger specified in Field command is fired. The Trigger/Field statements should look like:
;;define trigger 1
;; define trigger 2
Field name=f_script,mode=fapa,trigger=trigger1,function=ExecuteScript,parm=(settray, TRIGGERFOUND, trigger2 [,arguments] );
This will execute script file settray whenever trigger2 is fire, ExecuteScript function will not check trigger1, but trigger1 is still required for Field command. trigger1 and trigger2 could be the same, if they are, the Field statement equals:
Field name=f_script,mode=fapa,trigger=everypage,function=ExecuteScript,parm=(settray [,arguments] ).
Or When you need to execute a script function if the specific trigger is NOT fired, the trigger/ Field command should be like:
;; define trigger 1
;;define trigger 2
Field name=f_script,mode=fapa,trigger=trigger1,function=ExecuteScript,parm=(settray, TRIGGERNOTFOUND,trigger2 [,srguments] );
This will execute settray function if trigger2 is NOT fired, ExecuteScript function will not check trigger1, but trigger1 is still required by Field command. Pleasebe notified that in this case, trigger1 and trigger2 can not be the same since trigger1 is used to check whether or not the ExecuteScript function should be invoked, and trigger2 is used to check if the script settray should be executed.
All the arguments to be passed to the script file will not be interpreted by ExecuteScript function, which means for example, if %A% is going to be passed to the script file, ExecuteScript will pass %A% to script file without substitution. I did not substitute the variables is becuase all substituted variables also could be access from Script file, so script file need to handle all the variable substitution internally.