\define newTitle() myTiddler-{{{[tag[myTag]count[]add[1]]}}} \define newTiddler()<$wikify name="myTitle" text="<<newTitle>>" ><$action-createtiddler $basetitle=<<myTitle>> tags="myTag" /> </$wikify>\endThen use it like below
<$button actions=<<newTiddler>>>Create a new tiddler</$button>
You can customize this code to do more interesting jobs!
--Mohammad
I see a risk here in the count part:
Say you have made tid-1, tid-2 and tid-3. Then you delete tid-2. The next generated number will be 3 and collide with existing tid-3.
Just a thought.
Cheers,
Thomas
It is good to see what we will be able to do with the new opperators but the existing widgets can handle adding new tiddlers and incrementing n after the title.
Have you looked at that?
Tony
\define newTitle() myTiddler-{{{[tag[myTag]count[]add[$(inc)$]]}}}
\define newTiddler(n:0)<$set name="inc" value={{{ [<__n__>add[1]] }}}><$wikify name="myTitle" text="<<newTitle>>" ><$list filter="[<myTitle>] +[!has[title]]" emptyMessage=""" <$macrocall $name="newTiddler" n=<<inc>> /> """><$action-createtiddler $basetitle=<<myTitle>> tags="myTag" /></$list></$wikify></$set>\end\define newTitle() myTiddler-{{{[tag[myTag]removeprefix[myTiddler-]sort[]last[1]add[1]addprefix[0000]split[]last[3]join[]]}}}
\define newTiddler()<$wikify name="myTitle" text="<<newTitle>>" ><$action-createtiddler $basetitle=<<myTitle>> tags="myTag" /> </$wikify>\end
\define newTitle() myTiddler-{{{[[0]count[]add[$(inc)$]addprefix[0000]split[]last[3]join[]]}}}
\define newTiddler(n:0)
<$set name="inc" value={{{ [<__n__>add[1]] }}}>
<$wikify name="myTitle" text="<<newTitle>>" >
<$list filter="[<myTitle>] +[!has[title]]"
emptyMessage=""" <$macrocall $name="newTiddler" n=<<inc>> /> """>
<$action-createtiddler $basetitle=<<myTitle>> tags="myTag" />
</$list>
</$wikify>
</$set>
\end
<$button actions=<<newTiddler>>>Create a new tiddler</$button>