Date offset from clipboard selection

Hi all, I am new to TextBlaze & am having trouble with a specific section of code which is my final step until the snip is fully operational! For reference I am working off a MS Teams spreadsheet whereby I copy a transaction date, and need to offset this by -3 weeks within a calendar field. I can work out the offset itself but this only defaults from current/system date whereas the date on my clipboard can vary from 4 weeks to 12 weeks in future.

Ie. today is 18/07/2022 & the transaction date is 04/10/2022 (clipboard), I need to somehow lock the start date to clipboard then -3 weeks offset


hI @user571 - welcome to the forum, and respect for being so creative with Text Blaze :slight_smile:

Here's one way to do what you're asking.

NOTE: The forum is unable to preview the {clipboard} command in dynamic snippets, so for my example I'm going to use a {formtext} command to illustrate the inputting of the date.

Let's look at the example first. Then I'll explain what to do with it to get it to work with {clipboard} in your dashboard.

{formtext: name=date; default=04/10/2022}

The transaction date is {time: D/MM/YYYY; at={=date}; pattern=D/MM/YYYY} ({time: MMMM Do, YYYY; at={=date}; pattern=D/MM/YYYY})

The date shifted back by three weeks would be {time: DD/MM/YYYY; at={=date}; pattern=DD/MM/YYYY; shift=-3W} ({time: MMMM Do, YYYY; at={=date}; pattern=D/MM/YYYY; shift=-3W})

To get the date directly from your clipboard contents, you'll need to change the first line in the example above from:
{formtext: name=date; default=04/10/2022}

{formtext: name=date; default={clipboard}}

How to copy snippets to your dashboard

To copy snippets directly to your dashboard,
just follow the procedure in the animation below:

GIF - Copy Snippets to Text Blaze

Hi Cedric,

Awesome thanks for your help!

EDIT: I have fixed the bug - I just reversed the order of date shift vs formtext which placed the shift date ahead of other text & all good now!!

I just have one more bug that I need your expertise on. Is there any way once the date is formatted & then shifted -3 weeks, to then copy the -3wk shifted date to clipboard for part 2 of the snippet?

I have the automation now to a point where it shifts the date but inputs both the clipboard + the shifted date (image should be attached hopefully). The form field itself defaults to system date, and once pressed highlights all text which I would normally ctrl+v and tab along. I don't believe that TextBlaze supports ctrl+v so not sure how to create a workaround :frowning:


Thanks again

Hi @user571

There's actually an easier method using the {note} command.

Here's what it would look like:

{note}This sentence is not going to be inserted (see squiggly lines in the preview)

{endnote: trim=right}

This sentence is going to be inserted

Let me know if you need any help implementing this into your snippet.