Unusedtitle macro - Providing current tiddler as the baseName?

Folks,

I am trying to use the unusedtitle macro. It is possible to set a literal baseName from which to generate the new title, but how do I get it to do this, based on the currentTiddler value?

For the life of me I cant see how.

I want to assign this new potential title to a variable as well.

Fixed myself,

I had to wikify rather than set the value.

<$wikify name=next-subtiddler text="""<<unusedtitle "{{!!title}}">>""" >

If you wrap your whole code into a macro you could use text substitution:

\define titleFromCurrent() 
<$vars title=<<unusedtitle "$(currentTiddler)$">> >
{{{[<title>addsuffix[ hey]]}}}
</$vars>
\end

<<titleFromCurrent>>

@sull-vitsy that will work in some cases, but I needed the “unused title” stored in a variable for use in multiple places.

I am still working on the tool that uses this. Now the unused title is not changing after I create them. It keeps returning to “tiddlername 1”, unless I refresh the tiddler eg; edit/save

ActionCreateTiddler widget and unusedtitle macro got some boosts in v5.2.0

Especially for the actionCreateTiddler widget. See:

New in: 5.2.0 Note that the attributes $savetitle and $savedrafttitle are no longer needed. Instead, any action widgets that need to use the title of the newly created tiddler should be contained within the action-createtiddler widget, and reference the variables createTiddler-title and createTiddler-draftTitle to obtain the title.

I have got this working by moving the actions from the buttons actions parameter’s to inside the body. I do not have a full understanding of why but here is the resulting macro if you are interested;

I will mark this as solved on my own post but feel free to contribute. Thanks @pmario

\define create-subtiddler-actions()
<$action-sendmessage $message="tm-rename-tiddler" from=<<subtiddlertemp>> to=<<next-subtiddler>> />
<$action-setfield $tiddler=<<next-subtiddler>> domain={{!!domain}} parent=<<currentTiddler>>/>
<$action-sendmessage $message="tm-add-tag" $param="subtiddler"/>
<$action-navigate $to=<<next-subtiddler>> $scroll=no/>
<$action-setfield $tiddler=<<subtiddlertemp>> text=""/>
<$action-setfield $tiddler=<<currentTiddler>> last-subtiddler-date=<<now "YYYY0MM0DD1200000XXX">> />
\end
\define subtiddler-text-here()
<$set name=subtiddlertemp value={{{ [all[current]addprefix[$:/temp/]addsuffix[-subtiddler]] }}}>
<$edit-text tiddler=<<subtiddlertemp>> placeholder="subTiddler text" field=text class="tc-edit-texteditor tc-edit-texteditor-body" rows=1/>
<$list filter="[<subtiddlertemp>has[text]]" variable=nul>
   <$wikify name=next-subtiddler text="""<<unusedtitle "$(currentTiddler)$">>""" >
      <$button tooltip="clear text"><$action-setfield $tiddler=<<subtiddlertemp>> text=""/>{{$:/core/ui/Buttons/refresh}}</$button>
      <$button><<create-subtiddler-actions>> {{$:/core/images/new-button}} <<next-subtiddler>></$button>
   </$wikify>
</$list>
</$set>
\end

<<subtiddler-text-here>>

If you are interested in the actual solution do ask, it’s currently a work in progress. To easily create subtiddlers.

Notes:

  • The tagging is not occurring
  • This demonstrates creating tiddlers by edit
  • A temporary tiddler is “created by simply editing”, the create button actually renames this and sets various parameters on button click so no actioncreate tiddler is used…
  • This creates the subTiddler and opens it below (without navigation).