Configure '$:/config/FileSystemPaths' to save to a folder based on a field

140 views
Skip to first unread message

Sininho Sininho

unread,
Jan 22, 2020, 5:48:42 AM1/22/20
to TiddlyWiki
Hello! 

I am using TiddlyWiki under node.js (more specifically, TiddlyServer), and I want to find a way to save the new tiddlers to folders named in a field. 

I have a wiki where the tiddlers have a field "saveto". I've tried to add a line to the file '$:/config/FileSystemPaths' to prefix the name of the tiddler with the value of the "saveto" field. For example, the tiddler

created: 20200114160408003
modified: 20200114160440095
saveto: test
tags: 
title: New Tiddler
type: text/vnd.tiddlywiki


should be saved at test/New Tiddler.tid

Is it possible? I don't know much about filters, but I tried the following line and it did not work:

 [has[saveto]addprefix[/]addprefix{!!saveto}]

I am thankful for any help!

TonyM

unread,
Jan 22, 2020, 6:57:13 AM1/22/20
to TiddlyWiki
Quick tip

Use get rather than has if you want the value in the field.

Tony

Jeremy Ruston

unread,
Jan 22, 2020, 9:04:15 AM1/22/20
to TiddlyWiki
Hi Sininho

should be saved at test/New Tiddler.tid

Is it possible? I don't know much about filters, but I tried the following line and it did not work:

 [has[saveto]addprefix[/]addprefix{!!saveto}]

I am thankful for any help!

The catch is the the variable “currentTiddler” is not set during the evaluation of the filters in $:/config/FileSystemPaths, so it is not possible to use the {!!saveto}} construction, which implicitly uses the “currentTiddler" variable.

Instead, as Tony hinted, you may be able to use something like:

[has[saveto]get[saveto]addprefix[/]]

Best wishes

Jeremy



--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c97a3e67-d814-41e7-a740-4af2dc43fc3d%40googlegroups.com.

Sininho Sininho

unread,
Jan 22, 2020, 10:13:31 AM1/22/20
to TiddlyWiki
Thank you Jeremy and Tony for the prompt response!

Unfortunately, the proposed solution did not work. In the server window I found these lines: 

Sync error while processing 'New Tiddler':
Error: EACCES: permission denied, open '/test.tid'


which leads me to believe that it is is trying to save it to '/test.tid' instead of 'test/New Tidler.tid'. The tiddler did not get saved at all. 

Thank you again!



On Wednesday, January 22, 2020 at 3:04:15 PM UTC+1, Jeremy Ruston wrote:
Hi Sininho

should be saved at test/New Tiddler.tid

Is it possible? I don't know much about filters, but I tried the following line and it did not work:

 [has[saveto]addprefix[/]addprefix{!!saveto}]

I am thankful for any help!

The catch is the the variable “currentTiddler” is not set during the evaluation of the filters in $:/config/FileSystemPaths, so it is not possible to use the {!!saveto}} construction, which implicitly uses the “currentTiddler" variable.

Instead, as Tony hinted, you may be able to use something like:

[has[saveto]get[saveto]addprefix[/]]

Best wishes

Jeremy



--
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 tiddl...@googlegroups.com.

Jeremy Ruston

unread,
Jan 22, 2020, 12:19:11 PM1/22/20
to TiddlyWiki
Hi Sininho

Thank you Jeremy and Tony for the prompt response!

Unfortunately, the proposed solution did not work. In the server window I found these lines: 

Apologies. Let’s try again:

[has[saveto]get[saveto]] [get[title]] +[join[/]]

Good luck!

Best wishes

Jeremy



To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/12e0945b-5a8b-420f-bc86-dbc65dad9224%40googlegroups.com.

Sininho Sininho

unread,
Jan 23, 2020, 5:40:39 AM1/23/20
to TiddlyWiki
That worked! :-) 

Thank you a lot and have a good day! :-)
Hi Sininho
Reply all
Reply to author
Forward
0 new messages