<?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: Open all jsl files in a folder, find and replace text, save and close files in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762170#M94086</link>
    <description>&lt;P&gt;Look into using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Load Text File()&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Save Text File()&lt;/P&gt;
&lt;P&gt;rather than using Open().&lt;/P&gt;
&lt;P&gt;Load Text File() will bring the complete file into a single literal string variable and you will then be able to use Substitute() for the string and then save it back using the Save Text File.&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 21:31:57 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2024-05-31T21:31:57Z</dc:date>
    <item>
      <title>Open all jsl files in a folder, find and replace text, save and close files</title>
      <link>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762169#M94085</link>
      <description>&lt;P&gt;I want to write a script to open many jsl files in a folder. In each jsl file, I need to find a text and replace it with another text. Save each file and close it before going onto the next file in the folder. I tried to use "substitute" but did not work. Appreciate all the help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//folder contains 224 jsl scripts
folderID = "T:\JMP_SCRIPTS\Openfiles n update\test\";

Files = Files In Directory(FolderID);

For(i = 1, i &amp;lt;= N Items(Files), i++, 

	FileID = Files[i];

//Open jsl file
	openFile = Open(folderID || FileID);

	subdt = Substitute(openFile, "99@wefghynKm0r3", "hihi");

	openFile &amp;lt;&amp;lt; Save(folderID || FileID);
	Close(openFile, No Save);


);// End FOR loop
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Jun 2024 06:37:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762169#M94085</guid>
      <dc:creator>cchueng</dc:creator>
      <dc:date>2024-06-01T06:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Open all jsl files in a folder, find and replace text, save and close files</title>
      <link>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762170#M94086</link>
      <description>&lt;P&gt;Look into using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Load Text File()&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Save Text File()&lt;/P&gt;
&lt;P&gt;rather than using Open().&lt;/P&gt;
&lt;P&gt;Load Text File() will bring the complete file into a single literal string variable and you will then be able to use Substitute() for the string and then save it back using the Save Text File.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 21:31:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762170#M94086</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-05-31T21:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Open all jsl files in a folder, find and replace text, save and close files</title>
      <link>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762174#M94089</link>
      <description>&lt;P&gt;Facinating, thanks! It works for me!&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 03:53:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-all-jsl-files-in-a-folder-find-and-replace-text-save-and/m-p/762174#M94089</guid>
      <dc:creator>cchueng</dc:creator>
      <dc:date>2024-06-01T03:53:58Z</dc:date>
    </item>
  </channel>
</rss>

