StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
eugenes  
#1 Posted : Sunday, December 3, 2023 6:50:19 PM(UTC)
eugenes

Rank: Member

Reputation:

Groups: Approved
Joined: 12/2/2019(UTC)
Posts: 20

Thanks: 2 times
Hi

how do I create a text expansion which will insert the current date or time? I could not find any syntax about that.

Edited by user Sunday, December 3, 2023 6:51:58 PM(UTC)  | Reason: Not specified

Rob  
#2 Posted : Monday, December 4, 2023 12:14:22 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,343
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 415 time(s) in 354 post(s)
Try this - select Automation for the Method, then the Script tab:
Code:
var d = new Date();
sp.SendString(`${d.getFullYear()}-${("0"+(d.getMonth()+1)).slice(-2)}-${("0"+d.getDate()).slice(-2)} `
                     + `${("0"+d.getHours()).slice(-2)}:${("0"+d.getMinutes()).slice(-2)}`);

Code:
Output:
2023-12-03 19:14
eugenes  
#3 Posted : Wednesday, December 27, 2023 5:59:18 AM(UTC)
eugenes

Rank: Member

Reputation:

Groups: Approved
Joined: 12/2/2019(UTC)
Posts: 20

Thanks: 2 times
Thank you

but for some reason it works every other time
Swagboy69  
#4 Posted : Thursday, December 28, 2023 5:05:28 PM(UTC)
Swagboy69

Rank: Newbie

Reputation:

Groups: Approved
Joined: 8/31/2021(UTC)
Posts: 7
United States

Thanks: 1 times
Originally Posted by: Rob Go to Quoted Post
Try this - select Automation for the Method, then the Script tab:
Code:
var d = new Date();
sp.SendString(`${d.getFullYear()}-${("0"+(d.getMonth()+1)).slice(-2)}-${("0"+d.getDate()).slice(-2)} `
                     + `${("0"+d.getHours()).slice(-2)}:${("0"+d.getMinutes()).slice(-2)}`);

Code:
Output:
2023-12-03 19:14


Thanks for the script, very useful. I'd been looking for something like this, I used to be able to do it via PhraseExpress software, but am no longer using it.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.