[TW5] Have a Macro Insert the Value of a Tiddler as a Tag

147 views
Skip to first unread message

Taylor Jensen

unread,
Aug 30, 2016, 12:10:15 PM8/30/16
to TiddlyWiki
I have a tiddler named [[Current Show]], that has the text of something like "Romeo and Juliet". When I click on thew new journal button, I want the new tiddler to have a tag named "Romeo and Juliet". But won't change to something else if I modify it to be [[The Tempest]], that journal entry should still be tagged with "Romeo and Juliet".

I failed to find a way to accomplish this, and most of the things I tried led to awkward bits of code ending up as separate tags in the tiddler.

Anyone know how to do this? Thanks!

-TCJ

Tobias Beer

unread,
Aug 31, 2016, 1:42:09 AM8/31/16
to TiddlyWiki
Hi Taylor,

See if you can follow these instructions
to build a custom "my new journal" button,
because that's apparently what you need:

PMario

unread,
Aug 31, 2016, 6:57:11 AM8/31/16
to tiddl...@googlegroups.com
Hi TCJ

If possible, you could change your workflow a little bit. eg:

 - create a tiddler named: CurrentShow and tag it: Romeo and Juliet
 - save and don't close it.
 - Use the: New Here button from the tiddler CurrentShow  (view) toolbar

IMO that produces the exact outcome, with a little change from your side. No TW modifications needed.

You can activate the new here button with the ControlPanel: Appearence: Toolbars: View Toolbar   settings

-m

Taylor Jensen

unread,
Aug 31, 2016, 5:52:12 PM8/31/16
to TiddlyWiki
Unfortunately those instructions seem to only detail basic templating. The way I need my tiddlers created from a template to be tagged appear to be beyond the scope of that tutorial.

The problem is not changing a template, or the new journal button to do what I want, but making it so I can turn a transclusion or substitution into a tag for new tiddlers using that template.

Taylor Jensen

unread,
Aug 31, 2016, 5:56:21 PM8/31/16
to TiddlyWiki
Hmm, this is technically a solution. Unfortunately it costs time and convenience. Two things we can't afford in the theater. I don't know when or where I may have to take a new note, so I'd have to find that tiddler and then start clicking. But it's not the worst idea. Sometimes no-tech solutions are the best, but I think the constraints I have to deal with unfortunately make this note one of those times. Thanks tho!

-TCJ

Tobias Beer

unread,
Sep 1, 2016, 2:11:09 AM9/1/16
to TiddlyWiki
Hi Taylor,


Then, to have a button like the below become a toolbar button
marry that with the instructions at:
<$button>
<$action-sendmessage
$message="tm-new-tiddler"
title="Show Journal"
tags={{!!text}}
/>New Journal</$button>

For the full button candy, compare to the clone button:

$:/core/ui/Buttons/clone

Best wishes,

Tobias.

Taylor Jensen

unread,
Sep 1, 2016, 5:25:47 AM9/1/16
to TiddlyWiki
Tobias,

This is really close. Much closer than I got.

It successfully adds all the text in tags, plural. Where there are spaces in the {{Tiddler!!text}} it separates in to a new tag. Is there a way around this? Putting it in quotes of course just adds {{tiddler!!text}} as a tag.

-TCJ

Tobias Beer

unread,
Sep 1, 2016, 1:10:04 PM9/1/16
to tiddl...@googlegroups.com
Hi Taylor,

Many ways be leading to Rome.
The easiest way to go about it would be to have
the content be a link rather than just text:

[[The Tempest]]


A more complicated way would be to use a button template like:

title: $:/_toolbar/new-show-journal

\define as-link() [[$(title)$]]

<$list filter="[all[current]!field:title[$:/_toolbar/new-show-journal]]">
<$vars title={{!!text}}>

<$button>
<$action-sendmessage
$message
="tm-new-tiddler"
title
="Show Journal"

tags
=<<as-link>>
/>New Journal</$button>
</$vars>
</
$list>

Best wishes,

Tobias.

Taylor Jensen

unread,
Sep 3, 2016, 1:35:22 PM9/3/16
to TiddlyWiki
Tobias,

Perfect, having the content be a link works perfectly. Thanks so much!

-TCJ
Reply all
Reply to author
Forward
0 new messages