[Scilab-users] the name of a script

Jan Åge Langeland j-lan at online.no
Wed Mar 16 10:42:22 CET 2016



On 16.03.2016 10:11, fujimoto2005 wrote:
> Hi,JLAN
>
> Thanks for your reply.
>
> Your code return only
> "// -- 16/03/2016 18:04:51 -- //"
> as a.
>
> I  execute the script containing the following lines with the script name
> ''gettingSscriptName.sce'
>
> clear;
> a=gethistory();
> b=strsplit(a($), [filesep();'''']);
> disp(b($-1));
>
> The console window shows
> --> ecec('gettingSscriptName.sce')
>
> How to fix this?
>
> Best regards
>
>
Hi

It looks like you are looking in a(1). Try to look in b($-1).
scriptname=b($-1);

This soluton works with standard execute in Windows 10 at least.  It 
will probably not cover "strange" ways to execute a script, but by 
analyzing the last history string you should be able to figure out what 
the user has been doing.

Brgds
Jan Å





More information about the users mailing list