- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
using choose function to run different scripts
I am not sure this is possible, it does not seem to be working. I have written three different scripts to manipulate a data table and then journal a bunch of plots. The scripts are quite involved but fairly similar. However, I have them written in separate files. Then I wrote another script to create a new window with a radio box option to choose which script to run. I am using the choose conditional function to run the appropriate script. However, nothing seems to be happening. Are there any ideas where I may be going wrong? Is this a namespace thing because I have stayed away from this complicated subject?
thanks in advance
H
Clear Symbols();
//dialog for fitting options
dlg = New Window( "Fit By ...",
V List Box(
Panel Box( " choose an option: ",
rad1 = Radio Box( {"option1", "option2", "option3"} )
),
Text Box( " " ),
H List Box(
bok = Button Box( "ok",
fit = rad1 << get;
dlg << close window;
),
Text Box( " " ),
bcancel = Button Box( "cancel", dlg << close window )
),
Text Box( " " )
)
);
If( !Is Missing( fit ),
Choose( fit,
//option 1
Include( "script1.jsl" ),
//option 2
Include( "script2.jsl" ),
//option 3
Include( "script3.jsl" ),
)
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
You have a modeless dialog box, which will happily execute all commands after the new window() command while you are looking at the dialog box.
Try using a modal dialog box instead:
dlg = New Window( "Fit By ...", << modal,
.
.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
You have a modeless dialog box, which will happily execute all commands after the new window() command while you are looking at the dialog box.
Try using a modal dialog box instead:
dlg = New Window( "Fit By ...", << modal,
.
.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
That was it. Thanks for answering my simple and inexperienced question.
H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
Hello! I am using this script as a basis for my own. I can get my prompt window to pop up and both the OK and CANCEL buttons seem to work but the last portion here:
If( !Is Missing ( scriptselection ),
Choose (scriptselection,
//Run Rg Script
Include("Rg Script.jsl"),
//Run Camtek Script
Include("Camtek.jsl"),
//Run Probe 1/3 Script
Include("Probe 1/3.jsl")
)
);
Can you speak a bit more on this? I would like to open and immediately run these files from a location in my computer. Is this the correct approach? Or do I need to specify location more? (If so how do I do this?) Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
This is fairly old topic so syntax might have gone through some changes. Here is an example which should give you an idea how to develop your script:
Names Default To Here(1);
rb_selections = {"timeAnnouncer", "triangleProbability", "JMPStarter"};
scriptFolder = "C:\Program Files\SAS\JMP\15\Samples\Scripts\";
If(
nw = New Window("Dialog() example",
<<Modal,
<<Return Result,
V List Box(
Panel Box("choose an option: ", rb = Radio Box(rb_selections)),
H List Box(Button Box("OK", rbval = rb << get;), Button Box("Cancel"))
)
);
nw["button"] == 1,
Choose(rbval,
Include(scriptFolder || "timeAnnouncer.jsl"),
Include(scriptFolder || "triangleProbability.jsl"),
Include(scriptFolder || "JMPStarter.jsl");
),
Print("CANCEL");
);
Also see Scripting Index directly from JMP and JMP15 Scripting Guide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: using choose function to run different scripts
Wow Jthi! You hit the nail on the head here. Thank you so much. Works like a charm. I appreciate it.