[Scilab-users] the name of a script

Serge Steer Serge.Steer at inria.fr
Wed Mar 16 11:55:59 CET 2016


Le 16/03/2016 09:23, Jan Åge Langeland a écrit :
>
>
> On 16.03.2016 07:35, fujimoto2005 wrote:
>> 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
>>
>>
>
> a=gethistory();
> b=strsplit(a($),  [filesep();'''']);
> disp(b($-1));
>
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.

A solution is to use
  [units,typs,nams]=file()

This function return the property of all the files currently opened in 
the order they have been opened
so nams($) is what you are looking for:


Serge
>>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160316/f9b61a10/attachment.htm>


More information about the users mailing list