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
 All Forums
 Origin Forum
 Origin Forum
 expGraph: adding date-time to output file name

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AKazak 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
4   L A T E S T    R E P L I E S    (Newest First)
AKazak 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
ChaoC 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 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 Posted - 06/01/2026 : 2:24:49 PM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000