Mohammad,

I remember having an issue like this myself once, and this is how I solved 
it.
I cannot remember WHY it works this way.

\define remove-from-begining-tiltle-bulk(myfilter, n:"0")
<$list filter="[<__n__>] -0" variable=null>
<$list filter=<<__myfilter__>> variable="item">
<$list filter="""[<item>split[]rest[$n$]join[]]""" variable="newTitle">
<$list filter="[<newTitle>]  -[has[title]] -[[]]" variable="ignore">

<<actions1>>
<<actions2>>
</$list></$list></$list></$list>
\end

\define actions1()
<$action-setfield      $tiddler=$(item)$ title=$(newTitle)$ />
\end

\define actions2()
<$action-deletetiddler $tiddler=$(item)$ />
\end

<$button> Do it
<<remove-from-begining-tiltle-bulk myfilter:"[tag[xx]]" n:1>>
</$button>

Hope that helps.

Regards


On Monday, February 18, 2019 at 5:37:34 AM UTC+7, Mohammad wrote:
>
> The below code is developed to remove n characters from the beginning of a 
> tiddler title.
>
> Test only on https://tiddlywiki.com/prerelease/
>
>
> *Title: macro/remchars*
> *Tag: $:/tags/Macro*
> \define remove-from-begining-tiltle-bulk(myfilter, n:"0")
> <$list filter="[<__n__>] -0" variable=null>
> <$list filter=<<__myfilter__>> variable="item">
> <$list filter="""[<item>split[]rest[$n$]join[]]""" variable="newTitle">
> <$list filter="[<newTitle>]  -[has[title]] -[[]]" variable="ignore">
>   <$action-setfield      $tiddler=<<item>> title=<<newTitle>> />
>   <$action-deletetiddler $tiddler=<<item>> />
> </$list>  
> </$list>
> </$list>
> </$list>
> \end
>
>
> Assume you have three  tiddlers like below, both tagged with xx
>
> a1
> b1
> cd
>
>
> Then call the macro as below
>
> Test
> <$button> Do it
> <<remove-from-begining-tiltle-bulk myfilter:"[tag[xx]]" n:1>>
> </$button>
>
>
>  
> The above code should detect that removing first char will overwrite a1, 
> b1 and so as four list widget in the code (line 5)
> is responsible to prevent this!! seems it *FAILS *to do the job!
> It overwrites a1 and b1 and produces tiddler 1.
>
> What is going wrong here?
>
>
> --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 [email protected].
To post to this group, send email to [email protected].
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/e2926892-f708-40fd-85e3-ae7add4f2d98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to