Absolutely.  With the setfield command we are setting the value for the 
field _canonical_uri, text, and moved.  _canonical_uri is a default field 
that tiddlywiki looks for that marks the tiddler as a placeholder pointing 
to a specific address.  text is a default field containing the text of the 
tiddler. moved is a user created field we use to mark the tiddler as having 
been run through the script already so that tiddlywiki doesn't overwrite 
the moved image with the empty file we create with the script.  Ie if we 
didn't mark the image tiddlywiki would move the empty placeholder and 
overwrite the actual image on a second pass.

the setfield command looks for the field to set and then requires a tiddler 
with the value of the field as it's text.  so

the tiddler ..../empty_text is just an empty tiddler.  Therefore the text 
of the placeholder tiddler is set to empty.  You may have to use a space I 
can't remember.

the tiddler ..../moved_field has the text 'yes'.  therefore a field called 
move is created on that tiddler and it's value is set to yes.  now on 
subsequent passes of the script tiddly wiki will ignore this tiddler and 
only act on those images ( is[image] ) that do not have the value of yes ( 
!moved[yes] )

the tiddler ..../canonical-uri-external-image has the value of the 
_canonical_uri and generally requires some sort of transclusion of the 
tiddler title so that it is unique.  In my case is:
./images/<$view field="created" format="date" template="YYYY"/>/<$view field
="created" format="date" template="0MM"/>/<$view field="title"/>

This points to the directory that I saved to in the first line by adding 
the images/month/year to the filename of the actual image so that 
tiddlywiki moves it to that directory.

Hopefully that makes sense please feel free to ask. 

On Wednesday, November 4, 2020 at 11:20:57 PM UTC-5, Carlos R wrote:
>
> Sorry still new to tiddly, I ran into trouble running the script. Could 
> you share what these are? 
>
>    - $:/blog/templates/empty_text
>    - $:/blog/templates/moved_field
>    - $:/blog/templates/canonical-uri-external-image
>
> On Wednesday, November 4, 2020 at 5:32:13 PM UTC-8 Carlos R wrote:
>
>> This is extremely helpful I will give a shot using dropbox.
>>
>> On Wednesday, November 4, 2020 at 2:58:47 AM UTC-8 [email protected] 
>> wrote:
>>
>>> With both my nodejs and single file wikis I import images normally and 
>>> then occasionally run a script that moves them to an external directory and 
>>> creates a placemarker tiddler with a canonical uri:
>>>
>>>
>>> #!/bin/bash
>>>
>>> myyear=$(date +"%Y")
>>> mymonth=$(date +"%m")
>>>
>>> tiddlywiki --save [is[image]!tag[header-img]!moved[yes]] 
>>> [addprefix[./images/$myyear/$mymonth/]] \ # moves image to directory based 
>>> on year/month
>>>            --setfield [is[image]!tag[header-img]!moved[yes]] 
>>> _canonical_uri $:/blog/templates/canonical-uri-external-image text/plain
>>>
>>> tiddlywiki --setfield [is[image]!moved[yes]] text 
>>> $:/blog/templates/empty_text text/plain \
>>>            --setfield [is[image]!moved[yes]] moved 
>>> $:/blog/templates/moved_field text/plain
>>>
>>> Setting a field to 'moved' is crucial because otherwise tiddlywiki will 
>>> perform this operation on an emptied image and overwrite the original.
>>>
>>> So locally you could move the files to a synced folder or on a server it 
>>> might be a bit more complicated.
>>>
>>>
>>> On Monday, November 2, 2020 at 9:52:41 PM UTC-5, Carlos R wrote:
>>>>
>>>>
>>>> I am using nodejs version and I want a way to automatically upload 
>>>> files to a cloud storage service such as dropbox. Has anyone attempted 
>>>> this? I like to take screen shots with my notes and it's a bit cumbersome 
>>>> to have to manually link files/images.
>>>>
>>>> Thanks!
>>>>
>>>

-- 
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/8aff9f68-3cde-493d-aa74-83ebc035108ao%40googlegroups.com.

Reply via email to