Subscribe Bookmark RSS Feed

Saving with filename

vishwasanj

Contributor

Joined:

Dec 27, 2016

Hi,

 

How can i save with the filename attached to my .png graph? I want my script to take the filename of the graph I am opening and save it in the folder.

 <<save picture ("C:\...path..\ex1.png","png");  This is what I have right now.

Instead of ex1, is there a way to get the filename automatically?

 

1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

Solution
I am not exactly sure what you mean by opening a png graph . However , you can do something like this :
FilesList = Files In Directory(Your File Path) ; // This should give you list of all the files in the directory
for(i = 1 , i <= N Items(FilesList) , i++,
FileName = FilesList[i];
) ;
Now you have in FileName , the name of the file which you can use to append to your destination while saving

Best
Uday
Best
Uday
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

If you have opened your data table using the variable "dt" as the handle pointing to the data table, then you can get the name of the data table with the following:

 

     filename = dt << get name;

 

This, and all other items you can ask for from the data table is documented at:

     Help==>Scripting Index==>Data Table

Jim
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

Solution
I am not exactly sure what you mean by opening a png graph . However , you can do something like this :
FilesList = Files In Directory(Your File Path) ; // This should give you list of all the files in the directory
for(i = 1 , i <= N Items(FilesList) , i++,
FileName = FilesList[i];
) ;
Now you have in FileName , the name of the file which you can use to append to your destination while saving

Best
Uday
Best
Uday