<?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: How to save .csv-file as .jmp-file and exit JMP with JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19778#M18024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can schedule JSL scripts just as you can schedule .bat files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add a '//!' to the first line of your script OR change the .jsl to a .rpt and it will auto-run when opened.&amp;nbsp; Then just have your windows scheduler point to the JMP script instead of the batch file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just saying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Aug 2016 14:51:45 GMT</pubDate>
    <dc:creator>msharp</dc:creator>
    <dc:date>2016-08-05T14:51:45Z</dc:date>
    <item>
      <title>How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19773#M18019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a folder with 365 .csv-files. I want to convert each .csv-file into a .jmp-file and delete some columns in the .jmp-file, then save the .jmp-file with the name of the .csv-file and exit JMP. All this has to be done automatically with a JSL-Script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already have a batch-script, which starts a JSL-Script and hands one .csv-file to the JSL-Script. The JSL-Script then opens the .csv-file and deletes the columns i want to delete.&lt;/P&gt;&lt;P&gt;I have a problem, when it comes to saving the .jmp-file and quitting JMP with the JSL-Script in order for the batch-script to start with the next .csv-file to open with the JSL-Script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The .jmp-file won't save and therefor JMP doesn't quit, so that my whole batch-process stops, because my batch-script waits for JMP to be closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I open the .csv-files according to the response of user "twaintwist" at the bottom of this discussion: &lt;A href="https://community.jmp.com/thread/37335" target="_blank"&gt;Passing Parameters to JSL script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;All my .csv-files + the batch-script + the .jsl-script are in the same folder.&lt;/P&gt;&lt;P&gt;This solution works fine for me, so here is my batch-script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for %%f in (*.csv) do (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo fileName = "%%~nf.csv";&amp;gt;file.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; copy /y /b file.txt+myScript.jsl temp.jsl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JMP temp.jsl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timeout / t 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del %%~nf.csv&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timeout / t 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del file.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timeout / t 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del temp.jsl&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;pause&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My JSL-Script then opens the .csv-file handed over by the .bat-script, and deletes some columns. But after deleting the cloumns it seems like my JSL-Script just stops.&lt;/P&gt;&lt;P&gt;The .jmp-file won't save and JMP does not quit. As you can see in the Script I tried different methods to save and close the window with JSL.&lt;/P&gt;&lt;P&gt;So here is my JSL-Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;doc = Open(fileName);&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Turns off display updating to allow for quick updating of a data table.&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Begin Data Update;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ColList = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //#COLUMNS TO BE DELETED#&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Delete Columns(ColList);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; End Data Update;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nameLength = Length(fileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fielName = Left(fileName, nameLength - 3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Name = fileName || "jmp";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;save("C:\Users\MartinSchmid\Desktop\jsl_batch\" || Name);&lt;/P&gt;&lt;P&gt;doc&amp;lt;&amp;lt;save("C:\Users\MartinSchmid\Desktop\jsl_batch\" || Name);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wait(10);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Close (dt, nosave);&lt;/P&gt;&lt;P&gt;Close (doc, NoSave);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//doc &amp;lt;&amp;lt; close window;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//dt&amp;lt;&amp;lt;close window();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Close All(Data Tables, save(fileName+"jmp"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exit(nosave);&lt;/P&gt;&lt;P&gt;Quit(nosave);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2016 10:07:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19773#M18019</guid>
      <dc:creator>martinschmid</dc:creator>
      <dc:date>2016-11-09T10:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19774#M18020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the JSL log for messages.&amp;nbsp; closing dt and doc might be an issue; are they the same table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2016 13:10:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19774#M18020</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2016-08-03T13:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19775#M18021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You very much! Your solution solved my problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a total beginner in JSL I didn't know there was something like a log.&lt;/P&gt;&lt;P&gt;As I checked the log i noticed that my delete columns function didn't work as properly as I thought, because I misstyped one of the column-names and so the function stopped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nevertheless closing dt and doc was also wrong, but that wasn't too big of a problem in the end.&lt;/P&gt;&lt;P&gt;Once again thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2016 14:21:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19775#M18021</guid>
      <dc:creator>martinschmid</dc:creator>
      <dc:date>2016-08-03T14:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19776#M18022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, glad you got it working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also do all of this in JSL without a .BAT file.&amp;nbsp; That might (or might not) simplify your overall process.&amp;nbsp; JSL has a FilesInDirectory function and powerful string manipulation functions that can build and validate filenames.&amp;nbsp; If your current solution is too slow because of waits and timeouts and repeatedly starting/stopping JMP, you might want to eliminate the .BAT file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2016 14:53:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19776#M18022</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2016-08-03T14:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19777#M18023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately this process belongs to a bigger system and I need to be able to schedule it with windows scheduler, so I will need the .BAT anyways, but thanks for reminding me that it could be done in JSL only ;)&lt;/img&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2016 06:31:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19777#M18023</guid>
      <dc:creator>martinschmid</dc:creator>
      <dc:date>2016-08-04T06:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to save .csv-file as .jmp-file and exit JMP with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19778#M18024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can schedule JSL scripts just as you can schedule .bat files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add a '//!' to the first line of your script OR change the .jsl to a .rpt and it will auto-run when opened.&amp;nbsp; Then just have your windows scheduler point to the JMP script instead of the batch file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just saying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Aug 2016 14:51:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-save-csv-file-as-jmp-file-and-exit-JMP-with-JSL/m-p/19778#M18024</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2016-08-05T14:51:45Z</dc:date>
    </item>
  </channel>
</rss>

