<?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: Get name of current script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/39840#M23324</link>
    <description>&lt;P&gt;Not sure how long this function has been around, as I am fairly new to JMP, and I just found this function myself while trying to solve a similar problem, but it seems that the function "Include File List()" returns a list of open files that are in the context of the executing script. &amp;nbsp;(By the way, the description of this function is only sort of informative, as is the case for most functions/methods/messages in the Scripting Index or online resources.) &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that if this function is run at the top of the script before anything else is opened by the script that the script file path and script file name can be extracted from that as this is the only path returned at that point. &amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tested it with other files open in JMP, and ran the script by double clicking it from Windows Explorer (with the script set to run on open without opening a script editor window by including "//!" at the top of the script), I get only the path of that script returned. &amp;nbsp;None of the other opened files are returned. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jun 2017 14:41:18 GMT</pubDate>
    <dc:creator>BioData41</dc:creator>
    <dc:date>2017-06-01T14:41:18Z</dc:date>
    <item>
      <title>Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13763#M12943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to find a way to add the name of a script to the report created by the script. This means that I need to get a text string of the script name at some point. I can that the script file directory:&lt;/P&gt;&lt;P&gt;sDir=Get Default Directory();&lt;/P&gt;&lt;P&gt;and the files within that directory:&lt;/P&gt;&lt;P&gt;lFiles=Files In Directory(sDir);&lt;/P&gt;&lt;P&gt;But I haven't found a way to get only the file name I get is of the script I am currently running. The problem is that when finding a saved report later, I want to know exactly which script was run to produce said report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 12:41:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13763#M12943</guid>
      <dc:creator>JesperJohansen</dc:creator>
      <dc:date>2015-08-10T12:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13764#M12944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000dd; font-size: 10pt; font-family: Courier New;"&gt;Contains&lt;/SPAN&gt;&lt;SPAN style="; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;(lFiles&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"script.jsl"&lt;/SPAN&gt;&lt;SPAN style="; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;I used this to locate a JMP table by using ".jmp" and it worked for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;Or if I got your question wrong there is another way where you can loop over number of files in the directory and get the script file name like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000dd; font-size: 10pt; font-family: Courier New;"&gt;For&lt;/SPAN&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;n&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;n&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000dd; font-size: 10pt; font-family: Courier New;"&gt;N Items&lt;/SPAN&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;(&lt;STRONG style="font-family: Courier New;"&gt;lFiles&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;n&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; file&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;=l&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;files&lt;STRONG&gt;[&lt;/STRONG&gt;n&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000dd; font-size: 10pt; font-family: Courier New;"&gt;If&lt;/SPAN&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000dd; font-size: 10pt; font-family: Courier New;"&gt;Ends With&lt;/SPAN&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;file&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;".jsl"&lt;/SPAN&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;,/*Do your thing*/;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;Break();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:40:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13764#M12944</guid>
      <dc:creator>vs90</dc:creator>
      <dc:date>2015-08-10T15:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13765#M12945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't know if there's a way to do that.&amp;nbsp; I set a variable at the beginning of each script.&amp;nbsp; A bit tedious but helps with debugging.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black;"&gt;pname &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple;"&gt;"My Script.JSL"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:44:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13765#M12945</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2015-08-10T15:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13766#M12946</link>
      <description>&lt;P&gt;If the script is run from a script window, the direct approach in the example below give you the file name.&lt;/P&gt;
&lt;P style="font-family: Courier; color: #011993;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;scr_name = Current Window() &amp;lt;&amp;lt; get window title;
dt = Open("$SAMPLE_DATA/Big Class.jmp");
nw = New Window("My Report", Bivariate(Y(:weight), X(:height)), Text Box(scr_name));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 18:21:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13766#M12946</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2021-03-18T18:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13767#M12947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I came up with almost the exact same script (the "For"-loop) before I posted my question. The problem with it is that I don't know if the script it returns is the current one. If for instance the same script is saved in different versions in the same folder I would get a list of .jsl-files. I need to get the name of the current script running no matter how many similarly named scripts may be saved in the same location.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 05:39:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13767#M12947</guid>
      <dc:creator>JesperJohansen</dc:creator>
      <dc:date>2015-08-11T05:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13768#M12948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #555555; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;That was exactly what I deeded. Thank you &lt;/SPAN&gt;&lt;SPAN class="emoticon-inline emoticon_happy" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #555555;"&gt;&lt;/SPAN&gt;&lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.jmp.com/7.0.1.0/images/emoticons/happy.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 05:49:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/13768#M12948</guid>
      <dc:creator>JesperJohansen</dc:creator>
      <dc:date>2015-08-11T05:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/39840#M23324</link>
      <description>&lt;P&gt;Not sure how long this function has been around, as I am fairly new to JMP, and I just found this function myself while trying to solve a similar problem, but it seems that the function "Include File List()" returns a list of open files that are in the context of the executing script. &amp;nbsp;(By the way, the description of this function is only sort of informative, as is the case for most functions/methods/messages in the Scripting Index or online resources.) &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that if this function is run at the top of the script before anything else is opened by the script that the script file path and script file name can be extracted from that as this is the only path returned at that point. &amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tested it with other files open in JMP, and ran the script by double clicking it from Windows Explorer (with the script set to run on open without opening a script editor window by including "//!" at the top of the script), I get only the path of that script returned. &amp;nbsp;None of the other opened files are returned. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 14:41:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/39840#M23324</guid>
      <dc:creator>BioData41</dc:creator>
      <dc:date>2017-06-01T14:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of current script</title>
      <link>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/591874#M79596</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/8648"&gt;@BioData41&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As long as I use this in the script to reference it's own filePath it works when running the file by itself or when running the script from another script using Include().&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;scriptFilePath = Include File List()[1];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 Jan 2023 17:36:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-name-of-current-script/m-p/591874#M79596</guid>
      <dc:creator>bswedlove</dc:creator>
      <dc:date>2023-01-21T17:36:11Z</dc:date>
    </item>
  </channel>
</rss>

