[TW5] action-sendmessage create a tiddler with tag from tiddler title

439 views
Skip to first unread message

Shango

unread,
May 31, 2015, 9:54:45 AM5/31/15
to tiddl...@googlegroups.com
I am an experienced user of the classic TW.  I have many plugins and tweaks for it, all blinged out.  So I know how to do a lot with that.  Not so much with TW5 but I'm just getting more familiar with it or at least, trying to.  One of the great things about the classic TW is the forEachTiddler plugin so you can dynamically create content.  TW5 has the list widget as an equivalent, although I don't know how to get the list widget to create a table, like I can with the forEachTiddler, but that is for another day. 

What I'm trying to do now is create a tiddler with a button that generates a tiddler and tag the newly generated tiddler with the title of the tiddler that generated it, which is no problem, except that I also want to tag it with an additional tag as well.  I have not found a way to concatenate <<currentTiddler>> with a constant string for the tag.  The code for the button I'm using is:
<$button>
<$action-sendmessage $message="tm-new-tiddler" $param="ChatsTemplate" tags=<<currentTiddler>> title=<<tiddler.title>>/>
New Chat
</$button>

Where I have "<<currentTiddler>>" I also want another tag, but don't know how to add the additional tag without it breaking.  As it is now, it works similarly to how the "New Here" built in widget works. 

Thanks. 

Jed Carty

unread,
May 31, 2015, 1:10:36 PM5/31/15
to tiddl...@googlegroups.com
For this the easiest way is to use the action-sendmessage widget and the tm-add-tag message and the fieldmangler widget. Here is an example:

<$fieldmangler tiddler=<<tiddler.title>>>
<$button>label
<$action-sendmessage $message="tm-new-tiddler" $param="ChatsTemplate" tags=<<currentTiddler>> title=<<tiddler.title>>/>
<$action-sendmessage $message="tm-add-tag" $param=someothertag/>
New Chat
</$button>
</$fieldmangler>

To add more tags just add more tm-add-tag messages.

Shango

unread,
May 31, 2015, 3:14:29 PM5/31/15
to tiddl...@googlegroups.com
Thank you.  I feel like I'm in first grade and learning my ABCs.  But it seems more and more like this new TiddlyWiki is more like a platform for complex applications than a simple note organizing tool. 

Eric Shulman

unread,
May 31, 2015, 4:01:50 PM5/31/15
to tiddl...@googlegroups.com
On Sunday, May 31, 2015 at 12:14:29 PM UTC-7, Shango wrote:
Thank you.  I feel like I'm in first grade and learning my ABCs.  But it seems more and more like this new TiddlyWiki is more like a platform for complex applications than a simple note organizing tool.

It is both!

Straight out of the box, without any modifications, you can use TiddlyWiki as a "simple note organizing tool" to create tiddler content with basic formatting syntax, add a few keyword tags, and some links to other tiddlers using [[...]] and embedded images using {{...}}.  If that's all you really need, then TiddlyWiki is very quick and easy to learn.

Of course, TiddlyWiki can also be used as a "platform for complex applications", and that's where knowledge of macros, filters, widgets, themes, etc., comes in handy and really shows off the power of TiddlyWiki.  Sure, to really "get under the hood" and tinker, there is a bit of a learning curve.  Fortunately, however, you don't need to learn it all at once just to make a few customizations and apply a few macros and filters here and there.

enjoy,
-e
Eric Shulman
ELS Design Studios
TiddlyTools - "Small Tools for Big Ideas!"
InsideTiddlyWiki: The Missing Manuals

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:


Shango

unread,
May 31, 2015, 5:27:48 PM5/31/15
to tiddl...@googlegroups.com


On Sunday, May 31, 2015 at 1:10:36 PM UTC-4, Jed Carty wrote:

It is adding the tags to the tiddler that has the button, not the newly created tiddler.  Since the new tiddler's title is created dynamically, I don't know the name of the new tiddler until it is created, so I don't know how to reference it with the fieldmangler widget. 

 

Shango

unread,
May 31, 2015, 9:53:33 PM5/31/15
to tiddl...@googlegroups.com

Ok I think I got it working.  What this does is (when the button is clicked) it creates a new tiddler with a tag of the creating tiddler's title, in addition, another tag ("chats").  Also the newly created tiddler is named with the creating tiddler's title with "-chat" added as a suffix. 

I had expected that if more than one tiddler is created from the same tiddler, that it would add an incremental # at the end to create a unique tiddler, but it does not.  If a tiddler is created with the button and then it is pressed again, then the previously created tiddler is re-opened in edit mode.  I'm trying to see how to get it to increment so that it will create and additional tiddler if one already exists. 

\define chatTags() [[$(currentTiddler)$]] chats
\define chatTiddler() $(currentTiddler)$-chat

<$button>
<$action-sendmessage $message="tm-new-tiddler" $param="ChatsTemplate" tags=<<chatTags>> title=<<chatTiddler>>/>
New chat
</
$button>


 
Reply all
Reply to author
Forward
0 new messages