Discussion:
[tw5] Add/Remove Tags from Tiddler
(too old to reply)
Steven Schneider
2018-07-27 14:04:53 UTC
Permalink
Hello Old Friends:

I'm trying to write a macro that would add & remove tags from a tiddler
with a single button. I've got it working with two buttons, but am quite
sure I'm missing something very simple. Any suggestions would be much
appreciated. Thanks, //steve.

\define makeOld()
<$fieldmangler>
Add <<tag OldTopics>>
<$button message="tm-add-tag"
param="OldTopics">{{$:/core/images/new-button}}</$button>
<br>
Remove <<tag Topics>>
<$button message="tm-remove-tag"
param="Topics">{{$:/core/images/delete-button}}</$button>
</$fieldmangler>
\end

<<makeOld>>
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/3a5848e6-c8ef-4013-8263-81c4d1c9b6c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2018-07-27 14:36:43 UTC
Permalink
So, you want to do the two things at the same time? This seems to work:

\define myactions()
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="OldTopics"/>
<$action-sendmessage $message="tm-remove-tag" $param="Topics"></$button>
</$fieldmangler>
\end
\define makeOld()
Add <<tag OldTopics>> Remove <<tag Topics>>
<$button actions=<<myactions>>>{{$:/core/images/erase}}
</$button>
\end

<<makeOld>>

I changed the two buttons to an erase button since there is now one button
to do two things. But of course you can decorate it however you want. The
actions were moved to a macro and activated through the "actions" attribute
of the button, which is supposed to be the new way of doing things.

HTH

-- Mark
Post by Steven Schneider
I'm trying to write a macro that would add & remove tags from a tiddler
with a single button. I've got it working with two buttons, but am quite
sure I'm missing something very simple. Any suggestions would be much
appreciated. Thanks, //steve.
\define makeOld()
<$fieldmangler>
Add <<tag OldTopics>>
<$button message="tm-add-tag"
param="OldTopics">{{$:/core/images/new-button}}</$button>
<br>
Remove <<tag Topics>>
<$button message="tm-remove-tag"
param="Topics">{{$:/core/images/delete-button}}</$button>
</$fieldmangler>
\end
<<makeOld>>
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/d5568c47-755f-4b73-b5c4-b30baa0a9a1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Steven Schneider
2018-07-31 15:21:22 UTC
Permalink
Thanks, Mark. Worked perfectly!
Post by 'Mark S.' via TiddlyWiki
\define myactions()
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="OldTopics"/>
<$action-sendmessage $message="tm-remove-tag" $param="Topics"></$button>
</$fieldmangler>
\end
\define makeOld()
Add <<tag OldTopics>> Remove <<tag Topics>>
<$button actions=<<myactions>>>{{$:/core/images/erase}}
</$button>
\end
<<makeOld>>
I changed the two buttons to an erase button since there is now one button
to do two things. But of course you can decorate it however you want. The
actions were moved to a macro and activated through the "actions" attribute
of the button, which is supposed to be the new way of doing things.
HTH
-- Mark
Post by Steven Schneider
I'm trying to write a macro that would add & remove tags from a tiddler
with a single button. I've got it working with two buttons, but am quite
sure I'm missing something very simple. Any suggestions would be much
appreciated. Thanks, //steve.
\define makeOld()
<$fieldmangler>
Add <<tag OldTopics>>
<$button message="tm-add-tag"
param="OldTopics">{{$:/core/images/new-button}}</$button>
<br>
Remove <<tag Topics>>
<$button message="tm-remove-tag"
param="Topics">{{$:/core/images/delete-button}}</$button>
</$fieldmangler>
\end
<<makeOld>>
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/32c1fd32-c53c-493f-b965-cfc04c5a6ab2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Uwe
2018-08-01 16:13:19 UTC
Permalink
Hm, I'm wondering, why this code doesn't work at tiddlywiki.com.
Greetings,

Uwe
Post by 'Mark S.' via TiddlyWiki
\define myactions()
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="OldTopics"/>
<$action-sendmessage $message="tm-remove-tag" $param="Topics"></$button>
</$fieldmangler>
\end
\define makeOld()
Add <<tag OldTopics>> Remove <<tag Topics>>
<$button actions=<<myactions>>>{{$:/core/images/erase}}
</$button>
\end
<<makeOld>>
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/ee36b064-2d2b-444e-a3d9-aca69db822ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2018-08-01 16:58:08 UTC
Permalink
Works fine when I test it. Note that it doesn't toggle between the two
states -- that wasn't the original request.

-- Mark
Post by Uwe
Hm, I'm wondering, why this code doesn't work at tiddlywiki.com.
Greetings,
Uwe
Post by 'Mark S.' via TiddlyWiki
\define myactions()
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="OldTopics"/>
<$action-sendmessage $message="tm-remove-tag" $param="Topics"></$button>
</$fieldmangler>
\end
\define makeOld()
Add <<tag OldTopics>> Remove <<tag Topics>>
<$button actions=<<myactions>>>{{$:/core/images/erase}}
</$button>
\end
<<makeOld>>
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/714c07c3-b0b2-421a-a35e-76b515d9ec83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Elmiger
2018-08-05 13:10:18 UTC
Permalink
Hi folks,

I use the fabulous listops action for this (a bit complicated but reusable):

\define BtnTagListops(btntext,add-remove,tooltip)
<$button tooltip="""$tooltip$""">
<$wikify name="timestampState" text="{{$:/config/TimestampDisable}}">
<$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/>
<$action-listops $tags="$add-remove$" />
$btntext$
<$action-setfield $tiddler="$:/config/TimestampDisable" $value=<<timestampState>>/>
</$wikify>
</$button>
\end

This does change tags WITHOUT updating timestamps (it stores and restores the previous setting for updating timestamps). I call it from other macros like this one:

\define todoBtnDoNow()
<$wikify name="tt" text="switch tags">
<$macrocall $name="teBtnTagListops" btntext="Do this now" add-remove="ToDoNow -ToDo" tooltip=<<tt>>/>
</$wikify>
\end

<<todoBtnDoNow>> adds the tag ToDoNow and removes the tag with the minus (-) ToDo. You could add and remove as many tags as you like.

These are somewhat simplified macros, I hope they still work and it is clear how they work.

Cheers,
Thomas
(Back from offline vacation.)
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/36cda581-2c94-4332-b33b-f08b08ac5351%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...