<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Issue running JSL files in C#.NET in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53384#M30218</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10337"&gt;@ChrisM_X&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I actually managed to get it to run using your suggestion and a little luck of playing around. Here is my C# code that works.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;            // Create an instance of JMP and make it visible
            JMP.Application MyJMP; 
            MyJMP = new JMP.Application(); 
            MyJMP.Visible = true;
            MyJMP.ShowStartupWindow();
            MyJMP.EnableInteractiveMode(true);

            // create command 
            string arg1 = "base = 2"; // arguments to my User defined function in JSL 
            string arg2 = "expn = 3"; // arguments to my User defined function in JSL 
            MyJMP.RunCommand(arg1);  
            MyJMP.RunCommand(arg2);
            string FilePathOfFileToRun = "C:\\Test.jsl";
            MyJMP.RunJSLFile(FilePathOfFileToRun); // Running the user defined function 

            // Needed to keep JMP from automatically closing
            JMP.DataTable dt = MyJMP.NewDataTable("test");
            MyJMP.RunCommand(@"Close(Data Table(""test""), NoSave)");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Mar 2018 14:18:29 GMT</pubDate>
    <dc:creator>uday_guntupalli</dc:creator>
    <dc:date>2018-03-19T14:18:29Z</dc:date>
    <item>
      <title>Issue running JSL files in C#.NET</title>
      <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/3641#M3641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to execute JSL files in a C#.NET wrapper. I am able to sucessfully run the files but my code does not wait for the script to finish. Below is a sample:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JMP.Application jmpInstance = new JMP.Application();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileInfo fJSLFile = new FileInfo(@"C:\Test\Test.JSL");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jmpInstance.RunJSLFile(fJSLFile.ToString());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;if (jmpInstance.HasRunCommandErrorString())&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ApplicationException("Error with JMP script: " + jmpInstance.GetRunCommandErrorString());&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 22:20:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/3641#M3641</guid>
      <dc:creator>gpuckett</dc:creator>
      <dc:date>2011-08-10T22:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue running JSL files in C#.NET</title>
      <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53334#M30191</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4122"&gt;@gpuckett&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Were you able to figure this out ? I am looking to run JSL functions by passsing parameters to it from C#. Wondering if you could share any insight ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Mar 2018 17:39:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53334#M30191</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-03-17T17:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Issue running JSL files in C#.NET</title>
      <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53370#M30208</link>
      <description>I use myJMP.RunCommand(command); to pass data to JMP for C#, where command is a string you build up in C# to set up variables.&lt;BR /&gt;example&lt;BR /&gt;JMP.Application myJMP = new JMP.Application();&lt;BR /&gt;string command = "a=1";&lt;BR /&gt;myJMP.RunCommand(command);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Example code snippet below:&lt;BR /&gt;Below I set spec limits properties on columns that have specs:&lt;BR /&gt;&lt;BR /&gt;JMP.Application myJMP = new JMP.Application();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;foreach (var item in Specs)&lt;BR /&gt;{&lt;BR /&gt;bool setprops = false;&lt;BR /&gt;StringBuilder SpecList = new StringBuilder();&lt;BR /&gt;if (item.Value.LowerSpec.ToLower() != "nan")&lt;BR /&gt;{&lt;BR /&gt;SpecList.Append("LSL(Expr(" + item.Value.LowerSpec.ToLower() + ")),");&lt;BR /&gt;setprops = true;&lt;BR /&gt;}&lt;BR /&gt;if (item.Value.UpperSpec.ToLower() != "nan")&lt;BR /&gt;{&lt;BR /&gt;SpecList.Append("USL(Expr(" + item.Value.UpperSpec.ToLower() + ")),");&lt;BR /&gt;setprops = true;&lt;BR /&gt;}&lt;BR /&gt;// SpecList.Length--; //removes last characther from SB (ending comma)&lt;BR /&gt;if (setprops)&lt;BR /&gt;{&lt;BR /&gt;command = @"Eval(&lt;BR /&gt;Eval Expr(" +&lt;BR /&gt;"column(dts, Expr(\"" + item.Key + "\")) &amp;lt;&amp;lt; set property(" +&lt;BR /&gt;"\"spec limits\"," +&lt;BR /&gt;" {" + SpecList.ToString() + " Show Limits( 1 )}" +&lt;BR /&gt;@"))&lt;BR /&gt;); ";&lt;BR /&gt;&lt;BR /&gt;myJMP.RunCommand(command);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}</description>
      <pubDate>Mon, 19 Mar 2018 12:42:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53370#M30208</guid>
      <dc:creator>ChrisM_X</dc:creator>
      <dc:date>2018-03-19T12:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issue running JSL files in C#.NET</title>
      <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53382#M30216</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10337"&gt;@ChrisM_X&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thank you for the s&lt;SPAN&gt;nippet. I am trying to understand, where in your snippet are you invoking a function ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TestPower = function({base,expn},{default local},
			res = base ^ expn ; 
			Retrun(res); 
	            );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Let us assume we have a user defined function in JMP like the one shown above. Now, starting from C#, how can I invoke this function by passing it parameters for base and exp and run this function ?&amp;nbsp;&lt;BR /&gt;The snippet you shared addresses the part about how we can use the RunCommand function to pass a value, but can you use a simple example like this to explain the process a little more in detail ?&amp;nbsp;&lt;BR /&gt;So, if i have the above function stored as TestPower.jsl on my C:\ , can you kindly share on how I would be able to run using C#, by passing it the parameters and calling this function ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 13:46:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53382#M30216</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-03-19T13:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Issue running JSL files in C#.NET</title>
      <link>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53384#M30218</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10337"&gt;@ChrisM_X&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I actually managed to get it to run using your suggestion and a little luck of playing around. Here is my C# code that works.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;            // Create an instance of JMP and make it visible
            JMP.Application MyJMP; 
            MyJMP = new JMP.Application(); 
            MyJMP.Visible = true;
            MyJMP.ShowStartupWindow();
            MyJMP.EnableInteractiveMode(true);

            // create command 
            string arg1 = "base = 2"; // arguments to my User defined function in JSL 
            string arg2 = "expn = 3"; // arguments to my User defined function in JSL 
            MyJMP.RunCommand(arg1);  
            MyJMP.RunCommand(arg2);
            string FilePathOfFileToRun = "C:\\Test.jsl";
            MyJMP.RunJSLFile(FilePathOfFileToRun); // Running the user defined function 

            // Needed to keep JMP from automatically closing
            JMP.DataTable dt = MyJMP.NewDataTable("test");
            MyJMP.RunCommand(@"Close(Data Table(""test""), NoSave)");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:18:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Issue-running-JSL-files-in-C-NET/m-p/53384#M30218</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-03-19T14:18:29Z</dc:date>
    </item>
  </channel>
</rss>

