Okay...sorry Tony (I think I updated it above, but just in case I did not):

<$button>
<!-- 1. The title of the current tiddler is obtained into the 
whichTiddlerTag variable
        at this level that is what you get (unless of course you are in 
draft mode...in which case, 
        I guess you could use !!draft.of instead? )
  -->
<$set name="whichTiddlerTag" value=<<currentTiddler>> >
<$list filter="[tag<whichTiddlerTag>count[]]">
   <$list filter="[range<currentTiddler>subtract[1]]">
      <$set name="whichTiddler" filter="[tag<whichTiddlerTag>]" select=<
<currentTiddler>> >
              <$action-setfield $tiddler=<<whichTiddler>> $field="caption" 
$value=<<currentTiddler>> />
              <$action-setfield $tiddler=<<whichTiddler>> $field="tooltip" 
$value=<<whichTiddler>> />
              <$action-setfield $tiddler=<<whichTiddler>> $field="order" 
$value=<<currentTiddler>> />
    </$set>
</$list>
</$list>
</$set>
Set Tab Order, Tooltips and Captions
</$button>

The button defined above will not work (assign caption, tooltip, order) 
when in draft mode because it can't find anything tagged with the title of 
the tiddler, so if you press it when you're editing nothing happens.  If 
you press it when you're not editing it works.

I guess I want to be able to make it work when and when not editing.  

The goal is to make setting the captions (incremental number), tooltips 
(title caption) and order(incremental number) of the other tiddlers tagged 
with the currentTiddlers title have these fields so that when they are 
displayed as tabs they have numbers instead of titles, but you can still 
see them in the tooltips (also they are ordered, provided you use a filter 
for the tables like "[tag<currentTiddler>sort[order]".

On Monday, 20 April 2020 21:33:35 UTC-4, TonyM wrote:
>
> Perhaps reshare your fixed code so we can test it on tiddlywiki.com and 
> see if we understand your problem!
>
> Tony
>
> On Tuesday, April 21, 2020 at 5:38:24 AM UTC+10, leeand00 wrote:
>>
>> Okay nevermind; I got it; I found the subtract filter operator works 
>> great if you don't mind your tabs starting at 0; and I fixed it in the code 
>> above.
>>
>> On Monday, 20 April 2020 15:31:31 UTC-4, leeand00 wrote:
>>>
>>> When I read something, and I throw it into the wiki, I have a tendency 
>>> to chunk it into smaller examples...
>>>
>>> When I do this I use the "Excise" functionality to split the long text 
>>> out; it works great but...when I want to split it into tabs the tabs show 
>>> up with their full titles, and I'd prefer if I didn't have to go to every 
>>> single tiddler and add a caption, tooltip and order for ever single one; so 
>>> in looking into this I wrote the following macro so that they are 
>>>
>>>
>>>
>>> <$button>
>>> <!-- 1. The title of the current tiddler is obtained into the 
>>> whichTiddlerTag variable
>>>         at this level that is what you get (unless of course you are in 
>>> draft mode...in which case, 
>>>         I guess you could use !!draft.of instead? )
>>>   -->
>>> <$set name="whichTiddlerTag" value=<<currentTiddler>> >
>>> <!-- 2. Obtain a count of how many tiddlers have been Excised / tagged 
>>> with this tiddler's title -->
>>> <$list filter="[tag<whichTiddlerTag>count[]subtract[1]]">
>>> <!-- 3. A range is generated from 1 to number of excised tiddlers which 
>>> is now occupying the currentTiddler variable.-->
>>>    <$list filter="[range<currentTiddler>]">
>>> <!-- 4. For each item in the range from 1 to number of excised tiddlers 
>>> obtain the tiddler name into whichTiddler based on currentTiddler's 
>>> 1,2,3,4... -->
>>>       <$set name="whichTiddler" filter="[tag<whichTiddlerTag>]" select=<
>>> <currentTiddler>> >
>>> <!-- 5. whichTiddler contains the name of an individual excised tiddler 
>>> and currentTiddler is the number in the list. -->
>>>               <$action-setfield $tiddler=<<whichTiddler>> 
>>> $field="caption" $value=<<currentTiddler>> />
>>>               <$action-setfield $tiddler=<<whichTiddler>> 
>>> $field="tooltip" $value=<<whichTiddler>> />
>>>               <$action-setfield $tiddler=<<whichTiddler>> 
>>> $field="order" $value=<<currentTiddler>> />
>>>     </$set>
>>> </$list>
>>> </$list>
>>> </$set>
>>> Set Tab Order, Tooltips and Captions
>>> </$button>
>>>
>>> <!-- Displays tabs when we are in draft mode -->
>>> <<tabs "[tag{!!title}]">>
>>>
>>> <!-- Displays tabs when we are in view mode -->
>>> <<tabs "[tag{!!draft.of}]">>
>>>
>>>
>>> The script sort of works...not exactly...the first tiddler is always 
>>> skipped, I'm assuming because the select attribute of $set under 4. 
>>> wants to start with 0 instead of 1 and I don't know how to decrement it 
>>> though there are a number of Mathematical operators that have been added to 
>>> Tiddlywiki since I last looked at it.
>>>
>>> But anyway making this work would save massive amounts of time in 
>>> wikiing, any suggestions on how to make this work?
>>>
>>> Also the currentTiddler variable and how it changes makes the code 
>>> almost unreadable!
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/29e739b9-3bc4-45bd-b027-024919d3d320%40googlegroups.com.

Reply via email to