So doing a project and I am creating tiddlers no problem with the action-sendmessage widget with the tm-new-tiddler message. But I might have a need to be able to create a tiddler on button click that creates the tiddler “secretly”. So it creates the tiddler but doesn’t put it in the stream.
I tried sending a tm-save-tiddler and tm-close-tiddler after the tm-new-tiddler but nothing happens. I am guessing it’s because it navigates away?
There are other ways I can skin this particular cat, but I am curious if my initial approach is possible.
G’day,
I haven’t tried this with latest edition of TiddlyWiki, but you should be able to use the ActionSetFieldWidget to create a tiddler with a value in some field.
Set, say, the text field to some value. If the specified tiddler does not exist, it should get created.
You can use https://tiddlywiki.com/#ActionCreateTiddlerWidget or https://tiddlywiki.com/#ActionSetFieldWidget to create tiddlers without opening them in the Story Column.
enjoy,
-e
Oh shoot! I’ve been using the ActionSetFieldWidget a bunch but only to modify fields in existing tiddlers. I completely missed that aspect of it. works perfectly! thank you both!
Another handy use of ActionSetFieldWidget is to “clone” a tiddler, simply by setting the title field.
Let’s suppose you have a Tiddler named “TidA”, and you want to make a complete copy of it named “TidB”. You can achieve this via:
<$action-setfield $tiddler="TidA" title="TidB" />
While this might seem like it would rename TidA to TidB, what it actually does is to create a new tiddler named TidB with all the same fields and values as TidA, while leaving TidA itself unchanged.
If you actually do want to rename TidA instead of cloning it, you would use the above, followed by:
<$action-deletetiddler $tiddler="TidA" />
-e
oh that’s good too! I wound up using ActionCreateTiddlerWidget as I had wanted to have it copy a template tiddler and it was most obviously able to do so, but good to know about setfield as well. That rename bit, though, is also gold. need to squirrel that away! thank you!