Help wanted: Editor toolbar button to create Macro with one parameter being the current time

Hi everyone, happy Thanksgiving day to those who celebrate it!

I have a macro for a slider using the details element:

<<blurb c:"" t:"">>

C is the caption that the user edits freely, the details summary. T is the tiddler that gets revealed in a slider (the non-summary part of the details).

I would like an editor toolbar button that inserts the macro above but where the t parameter contains the present time, down to the second. The button would paste something like this:

<<blurb c:"" t:“2021-11-25 3:14:56”>>

This would save me a step. I would paste the macro, fill out the caption, save/close, and click the edit button at the end of the macro to open and edit the tiddler that will contain the text hidden by the slider.

Thanks to anyone who is willing to help me work this out. Blessings today.

My workaround for the moment is

  1. Pasting the blurb macro
  2. Pasting the date/time with this macro: Documenting TW — a non-linear personal web notebook

<<blurb c:"" t:“” j:"now">> (shorthand: <<blurb c:"" j:"now">>)

  • I’m sure a less verbose approach could be used, I just like self-explanatory verbosity…

Let your macro decide what to do. If j (for journal?) is equal to now, set t to <<now>> ?

And blessings right back at ya young fella.

And Happy Thanksgiving to you (mine, in Canada, has come and gone already). Tough time of the year to be a turkey …

Hi Charlie

I think I forgot some of the explanation.

t:"" = title of the tiddler to be transcluded in the slider. So it can’t be t:“now” or t=<<now>>. It needs to be "t:“2021-11-25 etc”

So I need some doohickey that grabs the current time and stamps it as part of the macro call.

Oh boy, best I bow out and let somebody else step in, because I obviously have no clue what you are trying to solve.

I think this is what you mean? At least you can tweak to suit.

DaveButton.json (584 Bytes)

Here’s a gif of what it does:
dave-button

Most of the code generated from: https://tiddlywiki.com/#How%20to%20create%20dynamic%20editor%20toolbar%20buttons

DaveButton.json (584 Bytes)

Now that I see what stobot did, I get what you were asking for.

Cognitive hiccups re attention-regulation disability: when I see “to insert a macro”, a “macro” in my head is the definition of a macro (i.e. define-end), and I could not figure out how a button that inserts the definition of a macro made any sense with everything else in your post. Now I get it: you want to insert a macro “reference” (some might say “call”, but I avoid that because I often fall back in the trap of thinking that a macro is a function).

Nothing at all wrong with what you wrote. All of that to say that if you wonder sometimes what in the world I’m thinking, it is probably way way out there. With a very slight possibility of being entertaining. High probability of being wordy …

I am going to mention a Stobot in my thanksgiving prayers! Thanks Adam! (and Charlie, too!) That works perfectly!

I am going to study that one and maybe create similar ones, to learn the ins and outs.

1 Like