<?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: Make add-in from application? Get app path? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41716#M24320</link>
    <description>&lt;P&gt;Additionally, this paper from &lt;A href="http://www.predictum.com" target="_self"&gt;Predictum&lt;/A&gt; would show how others have managed this:&amp;nbsp;&lt;A href="https://www.jmp.com/content/dam/jmp/documents/en/white-papers/jmp-add-in-management.pdf" target="_self"&gt;&lt;SPAN&gt;Best Practices in JMP&lt;/SPAN&gt;&lt;SPAN&gt;® &lt;/SPAN&gt;&lt;SPAN&gt;Add-In Management&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="page" title="Page 1"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Mon, 10 Jul 2017 09:30:19 GMT</pubDate>
    <dc:creator>ian_jmp</dc:creator>
    <dc:date>2017-07-10T09:30:19Z</dc:date>
    <item>
      <title>Make add-in from application? Get app path?</title>
      <link>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41688#M24305</link>
      <description>&lt;P&gt;Is there a way to create an add-in from an application I have built? The application is fairly complex and all I would like to do is bundle it into an add-in. Additionally, this problem might be solved if someone can help me solve the following problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built an application and have it in a folder (myApp/) and have scripts that I would like to include() from the source directory (myApp/src/). However, when I try to Get Default Directory() from within the app, it returns "/", which will not allow me to find the source folder if the application were run on a different computer. Is there a way to query the location of the&amp;nbsp;app that is currently running? Alternatively, is there a&amp;nbsp;way to bundle files into the application so I can reliably access my files (perhaps through a default path variable)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My attempts to put the application into an add-in have failed. I can't run the app (.jmpappsource or .jmpapp) from the add-in. Also, since the application is fairly complex, I don't want to rebuild it in the add-in builder. Is there a way I could organize the app into an add-in? It would be great if JMP added an "Export application as add-in" or "Create add-in from application" feature.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 22:19:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41688#M24305</guid>
      <dc:creator>laisteve17</dc:creator>
      <dc:date>2017-07-07T22:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Make add-in from application? Get app path?</title>
      <link>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41706#M24317</link>
      <description>&lt;P&gt;I had a similar issue when I tried to break down a JSL framework into multiple modules that would include each other. I solved it by adding the following code to the main module:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Find the current location in the source tree for the given file
__getThisPath = Function( {this_f},
	{Default Local},
	this_p = "";
	ifl = Include File List();
	For( ifli = 1, ifli &amp;lt;= N Items( ifl ), ifli++,
		a_path = ifl[ifli];
		idx = Contains( a_path, this_f );
		If( idx &amp;gt; 0,
			this_p = Left( a_path, idx - 1 );
			Break();
		);
	);
	If( this_p == "",
		Throw( "Unable to find path for " || this_f )
	);
	Return( this_p );
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once I determined my script location in the file system, I was able to use it to find and include its dependencies:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Use the current location in the source tree for this file
// in order to load its dependencies.
__INCLUDE = __getThisPath( "timeit.jsl" );
Set Path Variable( "TI_HOME", __INCLUDE );
Include( "$TI_HOME/../JSLhelpers/mfr.jsl" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:16:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41706#M24317</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2020-02-27T14:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Make add-in from application? Get app path?</title>
      <link>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41716#M24320</link>
      <description>&lt;P&gt;Additionally, this paper from &lt;A href="http://www.predictum.com" target="_self"&gt;Predictum&lt;/A&gt; would show how others have managed this:&amp;nbsp;&lt;A href="https://www.jmp.com/content/dam/jmp/documents/en/white-papers/jmp-add-in-management.pdf" target="_self"&gt;&lt;SPAN&gt;Best Practices in JMP&lt;/SPAN&gt;&lt;SPAN&gt;® &lt;/SPAN&gt;&lt;SPAN&gt;Add-In Management&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="page" title="Page 1"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Jul 2017 09:30:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41716#M24320</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-07-10T09:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Make add-in from application? Get app path?</title>
      <link>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41718#M24322</link>
      <description>&lt;P&gt;Thank you nascif_jmp for sharing your method and thank you ian_jmp for sharing the paper! Both were helpful but&amp;nbsp;I settled for a different approach - restructuring my app/addin. Here are the steps I took to ensure that my application would&amp;nbsp;find its include files, reliably,&amp;nbsp;on different computers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Put all&amp;nbsp;files/folders relevant to the application into a folder (I call it the app root directory, or root directory for short)&lt;/LI&gt;&lt;LI&gt;Use a path variable for the&amp;nbsp;app root directory and relative paths to refer to files and directories in the application.&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;For example,&amp;nbsp;a directory "$appRoot/" that contains a folder "src/" with my scripts and a "lib/" with images and icons. I refer to these as "$appRoot/src/" and "$appRoot/lib/"&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Save your app as a .jmpapp file, located somewhere under your app root directory or in one of its subdirectories (doesn't matter where as long as it's accessible&amp;nbsp;via relative path from the root folder)&lt;/LI&gt;&lt;LI&gt;Create an add-in and under additional files,&amp;nbsp;add the app root directory (jmp will also import all of its files and subdirectories as well to be included in the add-in).&amp;nbsp;These files will be located in the add-in's directory.&lt;/LI&gt;&lt;LI&gt;Now you can locate all of your files by refering to the add-in's directory, which is in a default location on each computer. This location is retrieved by doing getPathVariable("ADDIN_HOME("My Add In Name")). Use this to find the files and directories you added in the previous step. In your&amp;nbsp;add-in script, set the path variable to the add-in root directory:&lt;OL&gt;&lt;LI&gt;ADDIN_NAME = "My Add&amp;nbsp;In Name";&lt;/LI&gt;&lt;LI&gt;setPathVariable("appRoot", getPathVariable(evalInsert("ADDIN_HOME(^ADDIN_NAME^)")) || "App root directory/");&lt;/LI&gt;&lt;LI&gt;Set other path variables relative to this root&amp;nbsp;directory&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Run your application file from your add-in script by using open("$appRoot/pathToMyApp/myApp.jmpapp");&lt;/LI&gt;&lt;LI&gt;To distribute your application, instead distribute the add-in that contains your application along with its necesary files&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:50:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-add-in-from-application-Get-app-path/m-p/41718#M24322</guid>
      <dc:creator>laisteve17</dc:creator>
      <dc:date>2017-07-10T14:50:30Z</dc:date>
    </item>
  </channel>
</rss>

