what goes wrong here with: tm-download-file

93 views
Skip to first unread message

Mohammad

unread,
Dec 26, 2019, 12:56:20 AM12/26/19
to TiddlyWiki

This is a sample code to create an export button and lets save a set of tiddlers into a static .html

  • It uses a search box to lets filter all non system tiddlers tagged with Concepts
  • To reproduce 
    • Create a tiddler on tiddlywiki.com
    • copy and paste the below code and save it
    • next enter something in the saerch box to select some tiddlers (for example enter p)
    • next click on export and see nothing has been exported!!

\define myTag() Concepts

\define test-export()
<$edit-text tag=input tiddler=tid2 />

<$set name=searchTerms tiddler=tid2 field=text>
<$vars ufilter="[!is[system]tag<myTag>search:title<searchTerms>]" >
<<doExport>>

<$button>Export
<$action-sendmessage 
  $message="tm-download-file" 
$param="$:/core/templates/exporters/StaticRiver" 
exportFilter=<<ufilter>>
filename=<<exportButtonFilename """nella""">>/>
</$button>
<hr>

<$list filter=<<ufilter>> >

</$list>

</$vars>
</$set>
\end

<<test-export>>


It seems something goes wrong when I use variables to create the export filter

Mohammad

unread,
Dec 27, 2019, 10:04:58 AM12/27/19
to TiddlyWiki
It seems when I use <<ufilter>> tm-download-file does not work but for $(uifilter)$ it works!!

--Mohammad

Eric Shulman

unread,
Dec 27, 2019, 11:06:47 AM12/27/19
to TiddlyWiki
On Friday, December 27, 2019 at 7:04:58 AM UTC-8, Mohammad wrote:
It seems when I use <<ufilter>> tm-download-file does not work but for $(uifilter)$ it works!!

just a guess, but... I think that tm-download-file is processed asynchronously.

Thus, when using <<ufilter>>, the variable is not defined when the message is processed
but using $(ufilter)$ it is replaced by it's value when the message is sent, so that it's value
it available when the message is processed.

I've run into similar issues when using tm-modal, which is also asynchronous.

-e

Mohammad

unread,
Dec 27, 2019, 11:21:17 AM12/27/19
to TiddlyWiki
Hi Eric,
 Thanks for clarification!
Still I am confused when I should use <<var>>, <<__par__>> and when $(var)$ and $par$.

I followed your code on http://tiddlytools.com/filtergenerators.html and solved the issue in my last post
but with your explanation here, it seems I need a parsed value when I work with asynchronous .

I have collected some notes from forum to understand how to work with these vars and pars.

See TW-Scripts below (one is yours)


Still not fluent in coding when I encounter such cases!

--Mohammad

Chuck R.

unread,
Dec 28, 2019, 7:26:46 AM12/28/19
to TiddlyWiki
This is a sample code to create an export button and lets save a set of tiddlers into a static .html

That would be really handy, as I'm currently considering splitting a bunch of tiddlers from my TW5 file into a separate file. I might have to split off 30-40 tiddlers.


Mohammad

unread,
Dec 28, 2019, 8:35:14 AM12/28/19
to TiddlyWiki
I will add such tools to Favorites plugin will be published soon!
Reply all
Reply to author
Forward
0 new messages