| Author |
Topic  |
|
|
AKazak
Russia
1258 Posts |
Posted - 06/01/2026 : 12:17:59 PM
|
OriginPro 2026b (64-bit) Beta5 10.3.5.168 Windows 10 Pro
Greetings!
What LT substitution can I use to put the current or the host project saved date-time in a to the output file name?
Thank you.

--- Andrey |
|
|
ChaoC
USA
237 Posts |
|
|
AKazak
Russia
1258 Posts |
Posted - 06/01/2026 : 2:59:15 PM
|
quote: Originally posted by ChaoC
Hi Andrey,
With Substitution Enabled, you can use String Registers for the name. See: https://docs.originlab.com/labtalk/guide/labtalk-substitution-notation/ https://docs.originlab.com/labtalk/guide/string-registers/
To get the date of the project file, you can use the exist() function.
E.g. exist(%X%G.%@Q,5) //%X%G.%@Q is the full project filepath.
And convert it to a date string and set it to a String register: %B=date2str(exist(%X%G.%@Q,5),"MM_dd_yyyy")$;
Then in the Graph export dialog, you can use %B for the File Name.
Best, Chao
Dear Chao,
Seem to be not a trivial way...
How do I make %B=date2str(exist(%X%G.%@Q,5),"MM_dd_yyyy")$; dynamically updated on project save event?
What is the LT substitution for the current date-time?
Thank you.
--- Andrey |
 |
|
|
ChaoC
USA
237 Posts |
Posted - 06/02/2026 : 09:37:28 AM
|
Hello Andrey,
For current date-time, you can use @D.
To have it set on Project Save for a Project, you can use this code under the [BeforeSaveDoc] section of ProjectEvents.ogs:
%B=date2str(@D,"MM_dd_yyyy")$;
https://docs.originlab.com/labtalk/guide/projectevents-script/
If you want to do this for ALL projects, you can go to Help>Open folder> Program Folder and open MACROS.CNF and paste:
Def BeginSave {%B=date2str(@D,"MM_dd_yyyy HH mm")$;};
You will likely need admin privilege to save this file. Then, whenever you save the project file, it will run the script automatically.
See: https://docs.originlab.com/labtalk/ref/beginsave-macro/
Best, Chao |
 |
|
|
AKazak
Russia
1258 Posts |
Posted - 06/02/2026 : 3:12:53 PM
|
quote: Originally posted by ChaoC
Hello Andrey,
For current date-time, you can use @D.
To have it set on Project Save for a Project, you can use this code under the [BeforeSaveDoc] section of ProjectEvents.ogs:
%B=date2str(@D,"MM_dd_yyyy")$;
https://docs.originlab.com/labtalk/guide/projectevents-script/
If you want to do this for ALL projects, you can go to Help>Open folder> Program Folder and open MACROS.CNF and paste:
Def BeginSave {%B=date2str(@D,"MM_dd_yyyy HH mm")$;};
You will likely need admin privilege to save this file. Then, whenever you save the project file, it will run the script automatically.
See: https://docs.originlab.com/labtalk/ref/beginsave-macro/
Best, Chao
Dear Chao,
Works like a charm.
Thank you very much for sharing the real power of Origin!
Just for the reference: https://docs.originlab.com/labtalk/ref/date-and-time-format-specifiers/
--- Andrey |
Edited by - AKazak on 06/02/2026 3:13:32 PM |
 |
|
| |
Topic  |
|
|
|