<?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: Please help me remove carriage character in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286045#M55222</link>
    <description>&lt;P&gt;Here is how I would do it using the standard escape characters in JMP&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
cr = "\!r";
home_dir = "C:\dtemp
";
show(home_dir);
home_dir = substitute(home_dir, cr, "");
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which gave the reslts&lt;/P&gt;
&lt;PRE&gt;home_dir = "C:\dtemp
";
home_dir = "C:\dtemp";&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Aug 2020 20:27:25 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-08-14T20:27:25Z</dc:date>
    <item>
      <title>Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286013#M55213</link>
      <description>&lt;P&gt;I have a jsl script which calls python file to identify a specific directory from anywhere. It is working fine but he result has a carriage character which is ruining everything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cur_dir = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_dir, "/", "\" );
show(cur_dir);
_path_script = cur_dir || "find_home_directory.py";
show(_path_script);

home_dir = RunProgram(
					executable( "python" ),
					options( _path_script),
					readfunction( "text" )
				);
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;home_dir = "C:\dtemp&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;";&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Anyone , can you please help me how to convert this string to remove the carriage character and looks like this?&lt;/STRONG&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;home_dir = "C:\dtemp"&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:34:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286013#M55213</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2023-06-09T23:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286017#M55215</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cr = "
";
home_dir = "C:\dtemp
";
home_dir = substitute(home_dir, cr, "");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 18:08:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286017#M55215</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2020-08-14T18:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286031#M55216</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;'s solution is a good one! Here is a general reference to the &lt;A href="https://www.jmp.com/support/help/en/15.2/#page/jmp/escaped-characters-in-regular-expressions.shtml" target="_self"&gt;common invisible characters&lt;/A&gt; that might appear in a string of characters. You can use the escape sequence to search.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 18:34:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286031#M55216</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-08-14T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286035#M55217</link>
      <description>&lt;LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cur_dir = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_dir, "/", "\" );
show(cur_dir);
_path_script = cur_dir || "find_home_directory.py";
show(_path_script);

home_dir = RunProgram(
					executable( "python" ),
					options( _path_script),
					readfunction( "text" )
				);
show(home_dir);
cr ="
";
home_dir = substitute(home_dir, cr, "");
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Result is still the same..:(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;home_dir = "C:\dekel_post_processing&lt;BR /&gt;";&lt;BR /&gt;home_dir = "C:\dekel_post_processing&lt;BR /&gt;";&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 18:46:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286035#M55217</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2020-08-14T18:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286037#M55218</link>
      <description>&lt;P&gt;I tried it with&amp;nbsp;&lt;CODE class=" language-jsl"&gt;"(\r)" as&amp;nbsp;RegEx&amp;nbsp;search&amp;nbsp;but&amp;nbsp;still&amp;nbsp;getting&amp;nbsp;the&amp;nbsp;same&amp;nbsp;issue.&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cur_dir = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_dir, "/", "\" );
show(cur_dir);
_path_script = cur_dir || "find_home_directory.py";
show(_path_script);

home_dir = RunProgram(
					executable( "python" ),
					options( _path_script),
					readfunction( "text" )
				);
show(home_dir);
cr = Regex(home_dir,"(\r)");
home_dir = substitute(home_dir, cr, "");
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;home_dir = "C:\tmp
";
home_dir = "C:\tmp
";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I want:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;home_dir = "C:\tmp"&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 18:57:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286037#M55218</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2020-08-14T18:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286038#M55219</link>
      <description>&lt;P&gt;Although it works if you just run this few lines individually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cr = "
";
home_dir = "C:\dtemp
";
show(home_dir);
home_dir = substitute(home_dir, cr, "");
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;home_dir = "C:\dtemp
";
home_dir = "C:\dtemp";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 19:07:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286038#M55219</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2020-08-14T19:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286039#M55220</link>
      <description>&lt;P&gt;Maybe this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cur_dir = Substr( Get Default Directory(), 2 );
cur_dir = Convert File Path( cur_dir, Windows );
Show( cur_dir );
_path_script = cur_dir || "find_home_directory.py";
Show( _path_script );

home_dir = Run Program( executable( "python" ), options( _path_script ), readfunction( "text" ) );
Show( home_dir );

home_dir = Substitute( home_dir, "\r", "" );
Show( home_dir );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 19:37:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286039#M55220</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-08-14T19:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286042#M55221</link>
      <description>&lt;P&gt;yup finally it worked. The trick is following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;suppose you have a file "example.jsl" and you want to have the absolute path. You should do following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cur_dir = Substr( Get Default Directory(), 2 );
cur_dir = Convert File Path( cur_dir, Windows );
Show( cur_dir );
_path_script = cur_dir || "find_home_directory.py";
Show( _path_script );

home_dir = Run Program( executable( "python" ), options( _path_script ), readfunction( "text" ) );
Show( home_dir );

path_to_example_jsl = Substitute( home_dir, "\r", "example.jsl" );
Show( path_to_example_jsl );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The python file you call is simple:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import os
def find_home_dir():
	cur_dir = os.path.dirname(os.path.realpath(__file__))
	while True:
		if "file_which_defines_root" in os.listdir(cur_dir):
			break
		else:
			cur_dir = os.path.dirname(cur_dir)
	print(cur_dir.strip())

if __name__ == '__main__':
	find_home_dir()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 19:57:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286042#M55221</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2020-08-14T19:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me remove carriage character in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286045#M55222</link>
      <description>&lt;P&gt;Here is how I would do it using the standard escape characters in JMP&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
cr = "\!r";
home_dir = "C:\dtemp
";
show(home_dir);
home_dir = substitute(home_dir, cr, "");
show(home_dir);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which gave the reslts&lt;/P&gt;
&lt;PRE&gt;home_dir = "C:\dtemp
";
home_dir = "C:\dtemp";&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2020 20:27:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Please-help-me-remove-carriage-character-in-JSL/m-p/286045#M55222</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-08-14T20:27:25Z</dc:date>
    </item>
  </channel>
</rss>

