You must be logged in to reply to this topic.
I am a relatively newbie to adTempus. I am skilled in VBScript.
I am struggling to figure out how to pass a parameter to a shared script (written in VBScript) when it is called from a step within an adTempus job.
Can somebody help me out here, please .......
Thank you!
There are two ways you can pass parameters to your script.
1) Define the parameters in Job Variables for the job (on the Variables tab for the job or the step) and retrieve the variables from the script. For example if you set a Job Variable called "MyParameter" you would use this to get the value in the script:
x=adTempus.JobVariables("MyParameter")
This is a good way to do it if you want to be able to change parameters without editing script code.
2) If you want to set the parameters programmatically instead of using Job Variables then you cannot do this with a shared script because a shared script does not accept function arguments. The way you would do it is create a Script Library that has your method defined with the necessary arguments. Then in the job you would use a regular script (not a shared script) that references the library and calls the method and passes it the arguments that you want to use. For example in the library you would have
sub MyFunction(param) ...
and then in the script you would call the method:
MyFunction "paramvalue"
Set Command-Line Parameters to: cscript //nologo "\\celio\share\CCReportingDev\scripts\get_qclip_v1.wsf" /type:d /sbs:true
Your variables or command-line parameters are the items (in this example) /type: and /sbs: The consist of a forward slash, the parameter name you want to use, and a colon. The variable you pass in immediately follows the colon. Of course, you can have zero to many parameters along with the standard VBScript parameters.
In your code you check for what was passed in. Using my example above, here's the code that does the checking. We put the parameter code at the top of the program, right after the DIM clause(s):
The key component is wscript.arguments.name("stringName") where stringName does NOT include the forward slash nor does it include the colon. The forward slash simply lets the script know a parameter name is being passed and the colon separates the parameter name from the value being passed in.
You'll notice that I commented out writing to a log file, instead I output directly to the console. This allows me to see what's going on if I run the processes manually AND! it allows the output to be captured by ad Tempus if you set the Window Mode: to Capture Console. This way if there's an error I can check the Job Instance Details in the Captured Files tab and view the console output, helping me more quickly trouble-shoot.