Thanks Mohammad!

Very good. And excellent it silently creates the target tiddler if it 
doesn't exist. Exactly what I needed.

Best wishes
Josiah



On Saturday, 6 April 2019 22:31:06 UTC+2, Mohammad wrote:
>
> Hi Josiah!
>  This new version works ALSO with empty tiddlers
>
> \define append-text(tidTitle, text:"", btnLabel:"Append Text", sep:"<br>")
> <$button> $btnLabel$
> <$list variable="newText" 
> filter="[<__tidTitle__>get[text]addsuffix<__sep__>addsuffix<__text__>]" 
> emptyMessage="""<$action-setfield $tiddler=<<__tidTitle__>> 
> text=<<__text__>> />""" >
> <$action-setfield $tiddler=<<__tidTitle__>> text=<<newText>> />
> </$list>
> </$button>
> \end
>
>
>
> On Saturday, April 6, 2019 at 2:01:54 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Thanks for the quick response! Very useful tool!
>>
>> It works well except that if the target Tiddler (in the example TidB) has 
>> an empty text field it won't get appended to. 
>>
>> Is there a way to get the append working even if the text field is empty?
>>
>> Many thanks!
>> Josiah
>>
>> Mohammad wrote:
>>>
>>>
>>>  You may like the below macro!
>>>
>>>
>>> \define append-text(tidTitle, text:"", btnLabel:"Append Text", sep:
>>> "<br>")
>>> <$button> $btnLabel$
>>> <$list variable="newText" filter=
>>> "[<__tidTitle__>get[text]addsuffix<__sep__>addsuffix<__text__>]" >
>>> <$action-setfield $tiddler=<<__tidTitle__>> text=<<newText>> />
>>> </$list>
>>> </$button>
>>> \end
>>>
>>>
>>> *Examples*
>>> Test on Tiddlywiki.com. Create two tiddlers, titles TidA and TidB
>>>
>>> Example 1:
>>>
>>> <<append-text tidTitle:"TidB" text:"This is another text">>
>>>
>>> Example 2:
>>>
>>> <$macrocall $name=append-text tidTitle="TidB" text={{TidA}} sep=" " />
>>>
>>>
>>> Remarks
>>> Note changing a field needs some kind of triggering widgets! So, here I 
>>> used a button!
>>>
>>>    - *tidTitle *gets the title of tiddler you want to append text to it
>>>    - *text *the text to be appended
>>>    - *btnLabel*: the label for button
>>>    - sep: the separator is used when appending text to end of the text 
>>>    of tiddler
>>>
>>> If you want to append text of a base tiddler use syntax of example 2.
>>>
>>>
>>> I hope other people gives their solutions, comment for a better and more 
>>> concise macro!
>>>
>>> --Mohammad
>>>
>>>
>>>
>>> On Thursday, April 4, 2019 at 7:05:32 PM UTC+4:30, @TiddlyTweeter wrote:
>>>>
>>>> The use case is you create a tiddler and realise it would  be better 
>>>> added to another (not via transclusion, rather, the literal content of 
>>>> "text" is appended to another Tiddler's "text" field.).
>>>>
>>>> Do you know how to do this?
>>>>
>>>> Any tips appreciated.
>>>>
>>>> Best wishes
>>>> Josiah
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d7aa0b36-83d2-41c3-acfa-727c599616f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to