The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 expGraph: adding date-time to output file name
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1258 Posts

Posted - 06/01/2026 :  12:17:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Posted - 06/01/2026 :  2:24:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

AKazak

Russia
1258 Posts

Posted - 06/01/2026 :  2:59:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

ChaoC

USA
237 Posts

Posted - 06/02/2026 :  09:37:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

AKazak

Russia
1258 Posts

Posted - 06/02/2026 :  3:12:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
   Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000