<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 16/03/2016 09:23, Jan Åge Langeland
a écrit :<br>
</div>
<blockquote cite="mid:56E91809.9070502@online.no" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<br>
<br>
<div class="moz-cite-prefix">On 16.03.2016 07:35, fujimoto2005
wrote:<br>
</div>
<blockquote cite="mid:1458110112609-4033744.post@n3.nabble.com"
type="cite">
<pre wrap="">Hi, all
Is there any ways to get the name of script when I am executing it ?
I want to write a code to get the name of the script containing that code.
For example , suppose I execute a script named with 'abc.sce' and I want to
have a line which get the script name 'abc.sce' .
Best regards
</pre>
</blockquote>
<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(0,0,0);">a</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">gethistory</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">b</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">strsplit</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">a</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">$</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">filesep</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">''</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span>;
<span style="color:rgb(0,0,0);">disp</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">$</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span></pre>
<br>
</blockquote>
This works if the script execution has been launched at the prompt
level, but not if the script has been launched inside a function or
an other script.<br>
<br>
A solution is to use <br>
[units,typs,nams]=file()<br>
<br>
This function return the property of all the files currently opened
in the order they have been opened<br>
so nams($) is what you are looking for:<br>
<br>
<br>
Serge<br>
<blockquote cite="mid:56E91809.9070502@online.no" type="cite"> JÅ<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>