Dynamo Save-As File Name

We can specific a name for a dynamo output save-as file name. Can we let Dynamo pick a random name from 8 alphabets or use the current time format like YYYY-MM-DD-TTTT-SS as the file name? It may open up an option to let Dynamo save each iteration as an individual file automatically. I don’t know there is a way doing it in Dynamo nodes. It maybe something in Python.

Hi Joseph,

I use a code made by @Marcel_Rijsmus.
I found this a while back in another post but cant remember where…

This script finds the specific YYYY-MM-DD-TTTT-SS at the moment of running the script. We use it to do multiple print jobs in the same project.

This is the code:

dt=DSCore.DateTime.Components(DSCore.DateTime.Now);
pth=a+"\"+String.PadLeft(dt[“year”]+"",2,“0”)
+"-"+String.PadLeft(dt[“month”]+"",2,“0”)
+"-"+String.PadLeft(dt[“day”]+"",2,“0”)
+" - ("+String.PadLeft(dt[“hour”]+"",2,“0”)
+"."+String.PadLeft(dt[“minute”]+"",2,“0”)+") - ";

Again, i did not make this, it was Marcel. :slight_smile:

1 Like

Me, and a co-worker :slight_smile:

3 Likes

Thanks MVE1112 and Marcel_Rijsmus, I will give it a shot and make an update later.

Even though this topic is quite old I’d like to ask something:

Why didn’t you guys use the DateTime.Format node?
Seems less cumbersome to write and maintain and gives the same results:

Also, something weird happened to the code @Garbage_Collector posted, so I had to manually change some things, here is the code which doesn’t need editing:

dt=DSCore.DateTime.Components(DSCore.DateTime.Now);
pth=a+"\\"+String.PadLeft(dt["year"]+"",2,"0")
+"-"+String.PadLeft(dt["month"]+"",2,"0")
+"-"+String.PadLeft(dt["day"]+"",2,"0")
+" - ("+String.PadLeft(dt["hour"]+"",2,"0")
+"."+String.PadLeft(dt["minute"]+"",2,"0")+") - ";