Poor man's TiddlySaver

79 views
Skip to first unread message

Thomas Stone

unread,
Jun 3, 2020, 3:48:34 AM6/3/20
to TiddlyWiki
I have not tried to play around with running TW5 on Node.js. I don't prefer having to use TiddlyDesktop as a separate web browser. Installing a plugin would only save my wiki changes under the downloads directory. I like using a portable web browser on my thumb drive, and I am able to run non-admin programs on my computer. So I made a small program with a timer to move each saved TW file from my Downloads directory back to its original loading location.

I leave the program running all the time I am logged in. Alt-S saves the data in TiddlyWiki to the Downloads folder. After at most five seconds, the timer moves the file to overwrite the original location. The form flashes on the screen for one second and then hides itself until another move.

1) I created an alt-S shortcut macro to save the current wiki with a specific filename prefix (TWMove_), the entire file path - with substitutions for path-specific characters (: and \), and a time stamp. (Using split/join is accurate enough for me.)

Example: TWMove_C-colon-slash-RootDirOne-slash-SubDirTwo-slash-UrWiki.html

```

\define ExportSaveAll(ur_filename ur_stamp)
<$action-setfield $tiddler="$:/state/popup/DivPopTitle" text=""/>
<$action-setfield $tiddler="$:/state/sidebar" text="no"/>
<$action-sendmessage $message="tm-save-wiki" filename="TWMove_$ur_filename$-stamp-$ur_stamp$.html"
/>
\end
<$list filter="[{$:/info/url/full}split[file:///]join[]split[:]join[-colon-]split[.html]join[]split[%20]join[ ]split[/]join[-fslash-]split[%]join[-percent-]]">
<$macrocall $name="ExportSaveAll" ur_filename=<<currentTiddler>> ur_stamp=<<now format:"YYYYm0MMd0DDam0hhm0mms0ss">> />
</$list>
```

2) I have my web browser save all downloaded files to a specific Downloads folder. (Specifically on Google Chrome, I did install a plugin to automatically hide the dowloaded files bar. It was getting annoying.)

3) I created a small program with a multi-line textbox, and a timer to poll the Downloads folder every five seconds. It moves all the TWMove files in alphabetical order, so the latest timestamped file will be processed last. It finds the destination path as part of the filename. (Moving assumes the original TW.html file is not locked by the browser. This happened to me once, but I just had to restart the browser to release the file lock.)

The program's text box shows the folder I'm polling. When it picks up a file, the original path is pre-pended to the textbox's list of processed files and the form flashes in the foreground for a second. (I could have made a system tray pop-up notification instead.)

It's not perfect, but definitely doable for most amateur prograammers.

Reply all
Reply to author
Forward
0 new messages