Discussion:
[tw5] Button to create tiddler with title and time
Scott Kingery
2018-11-13 00:56:16 UTC
Permalink
Given a tiddler called "Tiddler X", I would like to include a button it
that would create a new tiddler called "Tiddler X: and the current date
time"

This non-working code is an example of what I mean

<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" text='{{||$:/project}}'
tags={{!!title}} title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">>/>
</$button>

I think I need to build a macro to get the title and time together in some
fashion but can't seem to sort it out.

If that can't be done then I'd like auto-increment so the new tiddler would
be {{!!title}}+# similar to how you get "New Tiddler 2" if one exists.

Thanks
--
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/f7e0af7e-c296-4e29-99b5-a3d87cf095c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2018-11-13 03:41:10 UTC
Permalink
This post might be inappropriate. Click to display it.
Scott Kingery
2018-11-13 14:49:33 UTC
Permalink
Thanks, Tony. Your clues to wikify helped.

I got closer. Now I just have to figure out how to concatenate the 2 fields.

<$wikify name=mytime text=<<now "YYYY-0MM-0DD hh12:0mmpm">> >
<$wikify name=mytitle text={{!!title}} >
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" tags={{!!title}} title=<
<mytime>>/>
</$button>
</$wikify></$wikify>
Post by TonyM
Scott,
Have you looked at the New Journal Button?
In Control Panel > Info > basics you set the new Title of Journal tiddler,
in $:/config/NewJournal/Title eg New Tiddler X YYYY-0MM-0DD
On the View Toolbar you can also go new Journal here.
Alternatively take a look at
https://tiddlywiki.com/#ActionCreateTiddlerWidget which is another way to
create tiddlers. which includes
$basetitle The initial title that will be attempted. If a tiddler with
that title already exists, then a numerical counter is added to the title
and incremented until it is unique
$savetitle A text reference identifying a field or index into which the
title of the newly created tiddler will be stored after it is created
Finally, title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">> will only
read as title={{!!title}}
I suggest you construct the title with the wikify widget and the now macro
before you place it in your action eg
title=<<new-title>>
Regards
Tony
Post by Scott Kingery
Given a tiddler called "Tiddler X", I would like to include a button it
that would create a new tiddler called "Tiddler X: and the current date
time"
This non-working code is an example of what I mean
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" text='{{||$:/project}}'
tags={{!!title}} title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">>/>
</$button>
I think I need to build a macro to get the title and time together in
some fashion but can't seem to sort it out.
If that can't be done then I'd like auto-increment so the new tiddler
would be {{!!title}}+# similar to how you get "New Tiddler 2" if one
exists.
Thanks
--
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/3f2097cf-9614-4d6d-92e3-7d44c2c70579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Scott Kingery
2018-11-13 19:36:44 UTC
Permalink
A bit more poking and prodding and I've go it:

\define concatenate() {{!!title}}: <<now "YYYY-0MM-0DD hh12:0mmpm">>


<$wikify name="newtitle" text=<<concatenate>> >
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" tags={{!!title}} title=<<
newtitle>>/>
</$button>
</$wikify>

Create a new tiddler from the current one using the current one's name and
the datetime. Also tags it with the current title. Sounds odd but it makes
sense for my current project :)
Post by Scott Kingery
Thanks, Tony. Your clues to wikify helped.
I got closer. Now I just have to figure out how to concatenate the 2 fields.
<$wikify name=mytime text=<<now "YYYY-0MM-0DD hh12:0mmpm">> >
<$wikify name=mytitle text={{!!title}} >
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" tags={{!!title}} title=<
<mytime>>/>
</$button>
</$wikify></$wikify>
Post by TonyM
Scott,
Have you looked at the New Journal Button?
In Control Panel > Info > basics you set the new Title of Journal
tiddler, in $:/config/NewJournal/Title eg New Tiddler X YYYY-0MM-0DD
On the View Toolbar you can also go new Journal here.
Alternatively take a look at
https://tiddlywiki.com/#ActionCreateTiddlerWidget which is another way
to create tiddlers. which includes
$basetitle The initial title that will be attempted. If a tiddler with
that title already exists, then a numerical counter is added to the title
and incremented until it is unique
$savetitle A text reference identifying a field or index into which the
title of the newly created tiddler will be stored after it is created
Finally, title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">> will only
read as title={{!!title}}
I suggest you construct the title with the wikify widget and the now
macro before you place it in your action eg
title=<<new-title>>
Regards
Tony
Post by Scott Kingery
Given a tiddler called "Tiddler X", I would like to include a button it
that would create a new tiddler called "Tiddler X: and the current date
time"
This non-working code is an example of what I mean
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" text='{{||$:/project}}'
tags={{!!title}} title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">>/>
</$button>
I think I need to build a macro to get the title and time together in
some fashion but can't seem to sort it out.
If that can't be done then I'd like auto-increment so the new tiddler
would be {{!!title}}+# similar to how you get "New Tiddler 2" if one
exists.
Thanks
--
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/12b2192d-7ed7-4506-90fe-9c101989eb30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2018-11-13 22:23:22 UTC
Permalink
Scott,

Glad you worked through it. The following would wor, saving some steps,

<$wikify name="newtitle" text="""{{!!title}}: <<now "YYYY-0MM-0DD
hh12:0mmpm">>""">

You can load quite a bit into the wikify and using the three quotes """
ensures the content can contain "

Regards
Tony
Post by Scott Kingery
\define concatenate() {{!!title}}: <<now "YYYY-0MM-0DD hh12:0mmpm">>
<$wikify name="newtitle" text=<<concatenate>> >
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" tags={{!!title}} title=<<
newtitle>>/>
</$button>
</$wikify>
Create a new tiddler from the current one using the current one's name and
the datetime. Also tags it with the current title. Sounds odd but it makes
sense for my current project :)
Post by Scott Kingery
Thanks, Tony. Your clues to wikify helped.
I got closer. Now I just have to figure out how to concatenate the 2 fields.
<$wikify name=mytime text=<<now "YYYY-0MM-0DD hh12:0mmpm">> >
<$wikify name=mytitle text={{!!title}} >
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" tags={{!!title}} title=<
<mytime>>/>
</$button>
</$wikify></$wikify>
Post by TonyM
Scott,
Have you looked at the New Journal Button?
In Control Panel > Info > basics you set the new Title of Journal
tiddler, in $:/config/NewJournal/Title eg New Tiddler X YYYY-0MM-0DD
On the View Toolbar you can also go new Journal here.
Alternatively take a look at
https://tiddlywiki.com/#ActionCreateTiddlerWidget which is another way
to create tiddlers. which includes
$basetitle The initial title that will be attempted. If a tiddler with
that title already exists, then a numerical counter is added to the title
and incremented until it is unique
$savetitle A text reference identifying a field or index into which the
title of the newly created tiddler will be stored after it is created
Finally, title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">> will only
read as title={{!!title}}
I suggest you construct the title with the wikify widget and the now
macro before you place it in your action eg
title=<<new-title>>
Regards
Tony
Post by Scott Kingery
Given a tiddler called "Tiddler X", I would like to include a button it
that would create a new tiddler called "Tiddler X: and the current date
time"
This non-working code is an example of what I mean
<$button>New Project
<$action-sendmessage $message="tm-new-tiddler" text='{{||$:/project}}'
tags={{!!title}} title={{!!title}} <<now "YYYY-0MM-0DD hh12:0mmpm">>/>
</$button>
I think I need to build a macro to get the title and time together in
some fashion but can't seem to sort it out.
If that can't be done then I'd like auto-increment so the new tiddler
would be {{!!title}}+# similar to how you get "New Tiddler 2" if one
exists.
Thanks
--
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/5958bdcb-c413-4d97-973e-73338e308cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mohammad
2018-11-14 04:10:41 UTC
Permalink
There is one issue!
When you title has space, then the tags={{!title}} would not work as
expected!

Check it

Mohammad
--
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/b5bc185f-cc52-4a18-ba34-d5ff3ad3a62f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Scott Kingery
2018-11-14 05:22:26 UTC
Permalink
Yeah, thanks Mohammad . Found out about the spaces issue the hard way.
Still thinking it though. Might store the value in a field instead.
Post by Mohammad
There is one issue!
When you title has space, then the tags={{!title}} would not work as
expected!
Check it
Mohammad
--
You received this message because you are subscribed to a topic in the
Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/tiddlywiki/nC5RtR1L01M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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/b5bc185f-cc52-4a18-ba34-d5ff3ad3a62f%40googlegroups.com
<https://groups.google.com/d/msgid/tiddlywiki/b5bc185f-cc52-4a18-ba34-d5ff3ad3a62f%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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/CAGUDtYEh2fzh03rQ10PeydfHX9B_dO1BEb5fG-Esc0TvtXFdJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Mohammad
2018-11-14 18:35:58 UTC
Permalink
Hello Scott,

Check this

Create a tiddler, name it what you like. Tag it with $:/tags/Macro
\define newTid(param:"", btn-caption:"New project", color:"#8058A5")
<$button style="color:$color$; fill:$color$; margin-bottom:5px;">
{{$:/core/images/new-button}} $btn-caption$

<$wikify name="newTitle" text="""{{!!title}}: <<now "YYYY-0MM-0DD
hh12:0mmpm">>""">
<$action-sendmessage $message="tm-new-tiddler"
title=<<newTitle>>
text="..."
tags="[[$param$]]"
/>
</$wikify>
</$button>
\end




In any tiddler you like to have the button put the below command

<<newTid param:"$(currentTiddler)$">>


Let me know if it works for you!

Mohammad
--
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/390b905a-3029-4777-a2bc-47edcace9649%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Scott Kingery
2018-11-14 21:47:35 UTC
Permalink
Mohammad,
Yes! Thanks a ton. A few modifications to give it exactly what I wanted to
pass to my new tiddler and it works perfectly. You also showed me how to
add color to my button :)
Post by Mohammad
Hello Scott,
Check this
Create a tiddler, name it what you like. Tag it with $:/tags/Macro
\define newTid(param:"", btn-caption:"New project", color:"#8058A5")
<$button style="color:$color$; fill:$color$; margin-bottom:5px;">
{{$:/core/images/new-button}} $btn-caption$
<$wikify name="newTitle" text="""{{!!title}}: <<now "YYYY-0MM-0DD
hh12:0mmpm">>""">
<$action-sendmessage $message="tm-new-tiddler"
title=<<newTitle>>
text="..."
tags="[[$param$]]"
/>
</$wikify>
</$button>
\end
In any tiddler you like to have the button put the below command
<<newTid param:"$(currentTiddler)$">>
Let me know if it works for you!
Mohammad
--
You received this message because you are subscribed to a topic in the
Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/tiddlywiki/nC5RtR1L01M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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/390b905a-3029-4777-a2bc-47edcace9649%40googlegroups.com
<https://groups.google.com/d/msgid/tiddlywiki/390b905a-3029-4777-a2bc-47edcace9649%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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/CAGUDtYFxA%3DE3UWyXzFMctAsYSnNQ9sFqwBhoZE0TPvkT_E_RWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...