- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Passing Parameters to JSL script
I have a script that generates graphs over a particular date duration (e.g. last 30 days) ----- the requirement is to generate multiple graphs over several more date durations (e.g. last 100 days, 365 days, etc.) ---- and these date durations will likely change over time.... So is there a way to pass a 'duration' parameter to the script? ---- or should I set a text file containing the duration value and read from it in the JSL script?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Passing Parameters to JSL script
How are you invoking the jsl script?
This is what I do if I need to execute a jsl script from a bat or such and pass the jsl a parameter....
- I write my jsl code as a Function with arguments and save it to it's own file - and it never changes.
- I have the bat file create a temporary jsl file that just includes the file from #1 and then has one line that is the call to the function but with the argument on it.
- Then I have the bat file start jmp with the file from #2
From dos prompt ..... cmd /c start jmp "C:\my_constructed.jsl"
where....
my_constructed.jsl contains (and keep in mind this is the tmp file that gets generated then run)
\\!
include ("C:\the_jsl_code_guts.jsl");
x = my_real_code(10);
then....
C:\the_jsl_code_guts.jsl.... contains....
my_real_code = Function(
// function arg
{duration_function_argument},
// local vars
{},
// your code that really does stuff.....
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Passing Parameters to JSL script
How are you invoking the jsl script?
This is what I do if I need to execute a jsl script from a bat or such and pass the jsl a parameter....
- I write my jsl code as a Function with arguments and save it to it's own file - and it never changes.
- I have the bat file create a temporary jsl file that just includes the file from #1 and then has one line that is the call to the function but with the argument on it.
- Then I have the bat file start jmp with the file from #2
From dos prompt ..... cmd /c start jmp "C:\my_constructed.jsl"
where....
my_constructed.jsl contains (and keep in mind this is the tmp file that gets generated then run)
\\!
include ("C:\the_jsl_code_guts.jsl");
x = my_real_code(10);
then....
C:\the_jsl_code_guts.jsl.... contains....
my_real_code = Function(
// function arg
{duration_function_argument},
// local vars
{},
// your code that really does stuff.....
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Passing Parameters to JSL script
Jane, thank you very much ---- I will give it a try....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Passing Parameters to JSL script
I like Jane's idea and it works great --- so I simply concatenate two files...
1. Create a text file with a line of JSL script that includes setting the parameter you want to pass in the Batch file (in DOS.... Echo Parameter1=30;>Parameter1.txt
2. Concatenate using the Copy command to create a temp.jsl script --- Copy /y /b Parameter1.txt+DataScript.jsl temp.jsl
--- so the first line of the temp file contains the 'Parameter1=30; ' jsl command AND all the other jsl scripting that uses the parameter....
3. Now that the temp.jsl has the full Datascript and the one line parameter setting we can run the jump script.....
DOS Batch script.....
Echo Parameter1=30;>Parameter1.txt | |
Copy /y /b Parameter1.txt+DataScript.jsl temp.jsl | |
JMP temp.jsl |