At the moment, on modern browsers, saving TW without any custom saver, means the save ends up in "Downloads".
We have no tool to auto/resurrect and copy back that save for those kinds of saves. Copying back has to be manual and can get complicated in a forest of downloads.
The more I think about this the more odd it seems.
I mean, with an "AUTO-RESTORE" from saves in Download to a wiki directory ANY browser could be used and with ANY version of TW. We would would not be dependent on specific solutions.
Any thoughts on how to do this? And its probable value?
I know Mark S. has thought about.Best wishesJosiah
Repeat for email users...
# File Stem names. Capitalize per actual file name.
# Stem must be absolutely unique! Otherwise it might detect wrong file.
$stemlist = @("notes","Todo")
# List of target directories in same order as stem names
$dirlist = @("D:\data\Wikis\notes","D:\data\TW2014")
# How many seconds to wait before checking again.
$waitSeconds = 10
#-- SOURCE DIRECTORY -- NOT USED YET ----------
$downloaddir = "C:\Users\Mark\Downloads"
while(1) {
for($i=0;$i -lt $stemlist.Length; $i++) {
$stem = $stemlist[$i]
$stem
$dir = $dirlist[$i]
#$dir
$copyme = ls $stem*.html | sort LastWriteTime | select -last 1
$copyme = $copyme.FullName
#$copyme
$destination = Get-Item "$dir\$stem.html"
$source = Get-Item "$copyme"
#echo Source: $source.LastWriteTime
#echo Destination: $destination.LastWriteTime
If($source.LastWriteTime -gt $destination.LastWriteTime.addSeconds(1) ) {
#echo "Source: " $source.LastWriteTime "greater than " $destination.LastWriteTime.addSeconds(1)
Copy-Item $copyme -Destination "$dir\$stem.html"
echo "Copying $copyme to $dir\$stem.html"
} Else {
echo "Will not be copying"
}
}
echo "Going to sleep..."
start-sleep -seconds $waitSeconds
}
Tested on ...
Windows 10 64-bit tablet
PowerShell: 6
Browsers: Vivaldi, Firefox, Edge, Chrome, 2 other Chromium
"Set-ExecutionPolicy -scope CurrentUser -executionPolicy Unrestricted"
"$stem(\s*\(\d+\))?$"
Ciao Mark S.It works! :-)Some initial comments .Tested on ...Windows 10 64-bit tabletPowerShell: 6Browsers: Vivaldi, Firefox, Edge, Chrome, 2 other Chromium
TEETHING PROBLEMS-- PowerShell would not run the script till I ran the (session only) command ..."Set-ExecutionPolicy -scope CurrentUser -executionPolicy Unrestricted"
BROWSERS -- SMALL ISSUETo my surprise not all modern browsers save the version number exactly the same way. Both "name (2).html" and "name(2).html" occur.
STEMMINGI don't understand how to do it but I think the stemming issue with possible overwrite could be avoided by using a regular expression rather than the general wildcard?This looks like it might work ....
"$stem(\s*\(\d+\))?$"But I'm unclear how PowerShell invokes the matching it can do (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-6).
INSTANCES?Just a thought for later. Based on my working practice.In actual usage I'd be more likely to set "$waitSeconds" to 600 since I don't write that much.
What I'm interested in knowing is if one could run a second instance of the script--identical except it just does a restore of wiki and then exits?
FURTHER TESTS--- I will play with running it via a batch file.
-- PowerShell would not run the script till I ran the (session only) command ..."Set-ExecutionPolicy -scope CurrentUser -executionPolicy Unrestricted"
How did you discover the secret recipe? I wonder if that's a PS6 thing?
Every day my Google News feeds reports problems people are having with updates on Windows 10. Makes me wonder if I should stick with Windows when support for 7 is dropped.
@TiddlyTweeter wrote:STEMMINGI don't understand how to do it but I think the stemming issue with possible overwrite could be avoided by using a regular expression rather than the general wildcard?This looks like it might work ....
"$stem(\s*\(\d+\))?$"But I'm unclear how PowerShell invokes the matching it can do (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-6).
That document explains how to do string matching. File globbing looks like regular expressions, but it's not. Possibly it would be possible to insert code that analyzes the output as strings. So one line of code would become 10 ;-)
but it's unclear -- is there an actual problem that would be fixed by this approach?
wiki1
Copying C:\Users\Josiah\Downloads\wiki1-b(2).html to C:\scrap\wiki1\wiki1.html
- If we have a clear way for all users to configure their computer for tiddlywiki handling, browser or OS independently we would all be happy
- TiddlyWiki can be used to do this itself (if running under tiddlydesktop) including setting up the above script of Marks, but then they have already had to install tiddlydesktop
There is the edge case where the $stem file is new, and there are no other $stem (\d).html files. Probably can be ignored ...
(1) not having to be browser focused [why should a user need to choose a specific browser brand? They should not have to!](2) Works the same way for all browsers and all versions of TiddlyWiki.
This threads title does little to promote this great idea. Which I only now understand because I spent a little time working through the conversations. I know much of this has being said but its being in discussion rather than statements.
Please let me try
When using the default save mechanism in any browser, you can save changes resulting in a download of the whole Wiki, having an automatic process on your computer, the wiki can then be copied back to your original single file wiki. There by keeping the original upto date. This is done by running a monitor and copy process in your local computer.
Open a tiddlywiki.html file (by another name) using your local file manager and it will open in your default browser. Without any other save mechanism in place, Each time you save, the browser will download the latest version of the wiki into your downloads folder. This means the updated version is not saved over the original version you opened, but you have a copy of the latest version.
(As I understand it) Mark S solution is to run a batch process on the computer to take any updated wiki copy in the downloads folder and copy it back to its source wikifile, thus keeping the original up to date.
My View on this
Josiah and Mark are right to think this could be a ground breaking way to manage wiki saves. Mark has done a good job of building a Powershell to do this. We can write batch shell scripts for every operating system and share these quite easily.
Personally I think an executable program to do the same, or even just install and help configure, may be a better option in time, allowing it to be installed Quickly and a version for each Operating system made available. These executables my just create the correct scripts.
Although this process seems somewhat universal it does expect a certain behaviour from the browser(s) which could actually change in time. We need to monitor this and add additional methods if these change.
Love your work
Regards
Tony
When using the default save mechanism in any browser, you can save changes resulting in a download of the whole Wiki, having an automatic process on your computer, the wiki can then be copied back to your original single file wiki. There by keeping the original upto date. This is done by running a monitor and copy process in your local computer.
Personally I think an executable program to do the same, or even just install and help configure, may be a better option in time, allowing it to be installed Quickly and a version for each Operating system made available.
I wrote a large post and lost it. I can repost soon. Its key items were,
I have identified a way to make the sentenial batch very efficient and potentially configureless. no need to worry about timing or performance impact. The same should work for bash scripts, but I could not write the bash one, except slowly. Perhaps I can even simplify it from a user and filename perspective including providing multi folder handling eg empty lives in documents/empty folder and prerelease in documents/prerelease.
However I must review marks script in detail first.
This is leading us down an interesting path which seems to be getting smoother as the idea matures.
What I can bring to this is my history as a batchfile guru many years ago, and some tricks I have up my sleeves.
Chat soon
Tony
There is the edge case where the $stem file is new, and there are no other $stem (\d).html files. Probably can be ignored ...
wiki1Get-Item : Cannot bind argument to parameter 'Path' because it is an emptystring.At C:\bag\z_pa\PortableApps\tw_nine-lives\tw_nine-lives_v01.ps1:37 char:26+ $source = Get-Item "$copyme"+ ~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingVal idationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAl lowed,Microsoft.PowerShell.Commands.GetItemCommand
wiki1
There are no downloads of this Wiki!
wiki1Get-Item : Cannot find path 'C:\scrap\wiki1\wiki1.html' because it does notexist.At C:\bag\z_pa\PortableApps\tw_nine-lives\tw_nine-lives_v01.ps1:36 char:22+ $destination = Get-Item "$dir\$stem.html"+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\scrap\wiki1\wiki1.html:Strin g) [Get-Item], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetIt emCommand
etc...
wiki1
The Wiki 'C:\scrap\wiki1\wiki1.html' does not exist!
I have identified a way to make the sentenial batch very efficient and potentially configureless.
This is leading us down an interesting path which seems to be getting smoother as the idea matures.
What I can bring to this is my history as a batchfile guru many years ago, and some tricks I have up my sleeves.
@echo off && color 0e && mode con:cols=85 && setlocal
:SETTINGS set "wikiDir=C:\bag\tw5\tws\" set "dldsDir=C:\Users\Josiah\Downloads\"
set "scriptVer=NINE-LIVES v0.1" set "ps1Script=tw_nine-lives_v01.ps1" set "startDelay=20" set "ps1Editor=notepad.exe"
:TITLE-WINDOW title %scriptVer%
:MENU echo: echo +============================+ echo %scriptVer% - Start Menu echo +============================+ echo ^| A - Auto-Monitor ^| echo ^| R - Restore ^& Quit ^| echo ^| T - TiddlyWiki ^| echo ^| D - Downloads (HTML/HTM) ^| echo ^| E - Edit PowerShell Script ^| echo ^| Q - Quit ^| echo +============================+ echo Auto-Monitor in %startDelay% seconds choice /c:ARTDEQ /d:A /t:%startDelay% /n /m "? Key: " if %errorlevel% equ 1 cls && echo: && goto RESTORE-MONITOR if %errorlevel% equ 2 cls && echo: && goto RESTORE-ONCE if %errorlevel% equ 3 cls && echo: && goto LIST-WIKI if %errorlevel% equ 4 cls && echo: && goto LIST-DOWNLOADS if %errorlevel% equ 5 echo: && goto EDIT-PS1-SCRIPT if %errorlevel% equ 6 endlocal && exit
:LIST-WIKI echo ^| WIKI FILES in "%wikiDir%" echo: dir /a /b /s /o:gn /t:w %wikiDir%*??.htm? echo: echo ^| EDIT SCRIPT "%ps1Script%" choice /c:YN /d:N /t:30 /n /m "? Key: Y/N" if %errorlevel% equ 1 echo: && goto EDIT-PS1-SCRIPT if %errorlevel% equ 2 cls && goto MENU
:LIST-DOWNLOADS echo ^| HTML ^& HTM FILES in "%dldsDir%" echo: dir /a /b /s /o:gn /t:w %dldsDir%*??.htm? echo: echo ^| EDIT SCRIPT "%ps1Script%" choice /c:YN /d:N /t:30 /n /m "? Key: Y/N" if %errorlevel% equ 1 echo: && goto EDIT-PS1-SCRIPT if %errorlevel% equ 2 cls && goto MENU
:EDIT-PS1-SCRIPT "%ps1Editor%" "%ps1Script%" cls && goto MENU
:RESTORE-ONCE :: NOT FINISHED :: The PS1 script needs to be in same directory as this batch file :: The script contains its own settings :: Need to pass parameter to run-once :: powershell.exe -file "%ps1Script%" -mode="run-once"
:RESTORE-MONITOR :: The PS1 script needs to be in same directory as this batch file :: The script contains its own settings powershell.exe -file "%ps1Script%"
I'm not a PowerShell aficionado, so even a short script takes some time.
Set-ExecutionPolicy -scope CurrentUser -executionPolicy Unrestricted
# SETTINGS -----------------------------------
# --- WIKI STEM NAMES: list of wiki stem names # Wiki name stem must be unique!! Case sensitive naming!! $stemlist = @("wiki1","wiki2")
# --- WIKI DIRECTORIES: list in same order as stem names $dirlist = @("C:\scrap\wiki1","C:\scrap\test\wiki2")
# --- DOWNLOADS DIRECTORY: where your browser(s) save downloads $downloaddir = "C:\Users\Josiah\Downloads"
# --- TIMING: How many seconds to wait between checks $waitSeconds = 60
# SCRIPT --------------------------------------clscd $downloaddirecho ""echo " | NINE-LIVES v0.1 (test)"echo " |"echo " | Every $waitSeconds secs checks for new saves in ..."echo " |"echo " | $downloaddir "echo " |"echo " | Press [Ctrl+C] to exit"echo ""
while(1) { for($i=0;$i -lt $stemlist.Length; $i++) { $stem = $stemlist[$i] $stem $dir = $dirlist[$i] #$dir $copyme = ls $stem*.html | sort LastWriteTime | select -last 1 $copyme = $copyme.FullName #$copyme $destination = Get-Item "$dir\$stem.html" $source = Get-Item "$copyme" #echo Source: $source.LastWriteTime #echo Destination: $destination.LastWriteTime If($source.LastWriteTime -gt $destination.LastWriteTime.addSeconds(1) ) { #echo "Source: " $source.LastWriteTime "greater than " $destination.LastWriteTime.addSeconds(1) Copy-Item $copyme -Destination "$dir\$stem.html" echo " Copying $copyme to $dir\$stem.html"
echo "" } Else { echo " ... is unchanged" echo "" } } echo " | Sleep for $waitSeconds seconds ..." start-sleep -seconds $waitSeconds echo ""}
Personally I think an executable program to do the same, or even just install and help configure, may be a better option in time,
I'm not a PowerShell aficionado, so even a short script takes some time.
woof 1 -- the settings part is fine for one or two wiki;
woof 2 -- the settings will likely be error prone (they will get messy, especially with long paths) if he has more than a few wiki, which he does;
woof 3 -- the "stemming" approach, rather than full specification (full path) of the Target Cat, may prove troublesome for Support Services as unanticipated overwrite restores remain possible;
woof 4 -- the essential dogfood point is that, maybe, "Nine-Lives" (provisional name), needs an additional first routine that can read a config file that parses exact full addresses and assembles an array of them for the main PS1? From, e.g. something like an "ini" file ...
[wikis]
C:\mylargedog\smallvariant\doggie\rover.html
C:\myhates\thosecats\gingerrrr.htm
[download-dir]
C:\User\Shep\Downloads
[timing]
60
A revised approach I have being researching and not yet made public seems to have predicted the above woofs.
Watch this space.
Tony
Re your ps script, I don't see where "downloaddir" gets used -- am I missing something?
cd $downloaddir
I had been thinking of having a separate configuration file. It might be easier to implement in powershell as a JSON file. Admittedly, your configurationfile would be easier to read. Do you think JSON will be adequate?
... are you just saying it's easier on the user to specify a single file/path at once? I can see that.
I just want the user to think a little bit about the stem issue. They might not realize that "mytiddlywiki.html" will overwrite "mytiddlywiki5.html".
I'm not sure what exe brings to the table. I guess it's a way to reduce every thing (initially) to a single file. But the user will still need to hand-edit a configuration file, so does it matter?
if($mode -eq "once") {echo " | $ninelives"echo " |"echo " | Run mode ""$mode"" completed!"echo " |"echo " | Closes in $closeSeconds seconds ..."start-sleep -seconds $closeSecondsclsexit}
Much to my surprise I got it working. The "$closeSeconds" (default "10") in the script mod is so the user has a few seconds to see what was restored before the script teminates.
The command line launch string needs the "-run [option]". For instance ...
powershell -file .\tw_nine-lives_v01bTT.ps1 -executionpolicy bypass -run once
Works well. To garner the value of "-run" the very *first* line of the PS1 script needs be ...
param ([string]$run)
A command line without a "-run" parameter will use the default mode ("menu").
I will post the whole script next so you can see it working.
PowerShell: 5.1.17763.503+============================+NINE-LIVES v0.1bTT+============================+| A - Auto-Monitor || O - Restore Once & Quit || T - TiddlyWiki || D - Downloads (.html/.htm) || E - Edit Settings || U - Usage || Q - Quit |+============================+? Key:
# USER SETTINGS -------------------------------# Note: ??User Settings may eventually be in an external file??
# --- WIKI STEM NAMES: list of wiki stem names# Wiki name stem must be unique!! Case sensitive naming!!$stemlist = @("wiki1","wiki2")
# --- WIKI PATHS: list in same order as stem names
$dirlist = @("C:\scrap\wiki1","C:\scrap\test\wiki2")
# --- DOWNLOADS DIRECTORY: where browser downloads go# Example path is the usual Windows location$downloaddir = "C:\Users\$Env:Username\Downloads"# --- WIKIS DIRECTORY (optional): useful if all wiki nest under one directory$wikidir = "C:\bag\tw5\tws"# --- TIMING: seconds to wait between checks$waitSeconds = 60
I am glad you are continuing this conversation. I do not have the capacity to contribute as I would at present. So I thought I would dump some design patterns and ideas I had for this.
After the save to disk by the browser, a move rather than rename will be faster on the same disk. To do this the previous version in the selected folder needs to be moved to a backups folder first, and the oldest deleted. If all that takes place is renames and deletes, downloads to folders then backups will be fast, with the only full write to disk done by the browser.
Now if we have document folders that contain only tiddlywiki html files we could use the fact that mywiki.html exists in these folder to look for mywiki.html in the browser download folder(s). Add a new wiki to this folder and it automatically joins those to be collected.
each browser should have a default downloads folder thus our solution could use these first and only the exceptions configured.
If a tiddlywiki is collected and removed from downloads immediately, it will always save as the same and original filename. No confusing versions or overwrite prompts. We need to cater for versions if the batch is not running for a while, but it can just iterate the versions the same way with moves.
It would be possible to run a batch command in any folder that adds (appends) that folder to those to be scanned for in download folders. Even better would be to add this to the desktops file manager to get a r-click to select that folder. This iteration can also scan for subfolders.
In windows at least a simple registry entry can associate .tw files with your default browser and clicking a tw file will open as usual in the browser. If this is done tw files could be placed in any folder with any files including other html files and you could even auto detect downloaded tw files and move them to a default folder.
With .tw files you could select your documents folder and it and all its sub folders could be scanned to locate .tw files to check for in downloads, and to identify where they beling. Again reducing the need for configuration.
A recent change to tiddlywiki allows you to set the download filename before you download the first time. You could do this to ensure it is unique and maybe even name it to a .tw file. Then it would automagicaly be managed by the local scripts.
Whilst these solutions aim to be universal we do need a different one for each operating system, so will it ever be universal? A multiple os intaller could solve this. Having .tw files could make it possible to auto configure everything.
Using the above should be compatible with timimi being installed because once it is running you just open the wikis and timimi handles the save and no download occurs. Timimi already works with .tw files.
This process should work along with tiddlydesktop and tiddlyserver as well but we could consider some helper functions to make the transition simpler. Once again this can be improved by using .tw files because we can differentiate these from common or garden html files.
Finally we could integrate it with a node install by pointing to the right folder.
Regards
Tony
Now if we have document folders that contain only tiddlywiki html files we could use the fact that mywiki.html exists in these folder to look for mywiki.html in the browser download folder(s). Add a new wiki to this folder and it automatically joins those to be collected.
If a tiddlywiki is collected and removed from downloads immediately, it will always save as the same and original filename. No confusing versions or overwrite prompts.
We need to cater for versions if the batch is not running for a while, but it can just iterate the versions the same way with moves.
It would be possible to run a batch command in any folder that adds (appends) that folder to those to be scanned for in download folders. Even better would be to add this to the desktops file manager to get a r-click to select that folder. This iteration can also scan for subfolders.
In windows at least a simple registry entry can associate .tw files with your default browser and clicking a tw file will open as usual in the browser. If this is done tw files could be placed in any folder with any files including other html files and you could even auto detect downloaded tw files and move them to a default folder.
With .tw files you could select your documents folder and it and all its sub folders could be scanned to locate .tw files to check for in downloads, and to identify where they beling. Again reducing the need for configuration.
A recent change to tiddlywiki allows you to set the download filename before you download the first time. You could do this to ensure it is unique and maybe even name it to a .tw file. Then it would automagicaly be managed by the local scripts.
Whilst these solutions aim to be universal we do need a different one for each operating system, so will it ever be universal?
A multiple os intaller could solve this. Having .tw files could make it possible to auto configure everything.
Using the above should be compatible with timimi being installed because once it is running you just open the wikis and timimi handles the save and no download occurs. Timimi already works with .tw files.
This process should work along with tiddlydesktop and tiddlyserver as well
[wikis]
file1=D:\data\Wikis\notes\notes.html
file2=D:\data\TW2014\Todo.html
[general]
; --- DOWNLOADS DIRECTORY: where browser downloads go
; Example path is the usual Windows location
downloaddir = "C:\Users\mark\Downloads"
; --- WIKIS DIRECTORY (optional): useful if all wiki are nest under one directory
wikidir = "C:\temp\wikis"
; --- TIMING: seconds to wait between checks
waitSeconds = 60
[wikis]
file1=D:\data\Wikis\notes\notes.html
file3=D:\data\TW2011\Todo.html
file4=D:\data\TW2012\Todo.html
file5=D:\data\TW2014\Todo.html
file9=D:\data\TWfuture\Todo.html
The only thing that needed changing was the "publisher" (matching set) quotemarks that you used around the title. The code wants "terminal" quotes (non-matching). Not sure what the terminology is.
I found some code that can read and parse an ini file, so I'm working on inserting that so that we can share the core code without having to paste in our ownpersonal settings values each time.
Tony's idea re a wikis directory is interesting. It occurs to me that you could run two instances of 9-lives, one in each mode.
powershell -file .\tw_nine-lives_v01bTT.ps1 -executionpolicy bypass -ini tonysettings.ini -run auto
Auto-Collation of paths to Wikis under a "Wikis Folder"?Now if we have document folders that contain only tiddlywiki html files we could use the fact that mywiki.html exists in these folder to look for mywiki.html in the browser download folder(s). Add a new wiki to this folder and it automatically joins those to be collected.
Its a neat idea. But is it realistic? Possible issues ...
- Whilst I keep my single-file wikis largely nested under one directory I also have other ".html / .htm" files in there too (e.g. output of static exports of TW) which would get erroneously listed under that system.
- It suggests a user have a specific "TW Folder" (TWF) to store TW under. And you have "exceptions" too (i.e. paths outwithTWF could be manually added) ...
- ... but with any "exception" you'd be back to the existing issue of selecting exact addresses. Overall, I think ONE method (manual) for adding candidate wiki is probably less complex to understand than having TWO (auto + manual "exceptions") in the end?
- I don't think one should assume users actually organise their wiki this way as a norm? I mean, I don't know where users store their wiki.
Immediate Move From Downloads?If a tiddlywiki is collected and removed from downloads immediately, it will always save as the same and original filename. No confusing versions or overwrite prompts.
Clever idea! Though, issues I think?
- A major issue would be TIMING. You'd need to have a script continuously polling every few seconds the downloads directory for new downloads of "mywiki.html".
We need to cater for versions if the batch is not running for a while, but it can just iterate the versions the same way with moves.Exactly!
- IMO users should be able to restore without having to constantly run a script ...
- ... which brings one back to a method to locate the latest and copy and rename it--which is what Mark S.' script does already
- Again, you seem to be suggesting TWO methods---one where you rapidly move a download save back with no name change, and---a second that renames and copy/moves back. Why not just ONE method? Since the second method removes the need for the first, why have the first?
Changing Content of Downloads?An additional point is perhaps more philosophical...
- In using a method to restore wiki from downloads I'm uncomfortable with idea we'd also be managing files in Downloads. Changing the content of downloads seems more for a dedicated backup system, or explicit deletion by the end user?
- In short, a "restore" script should not change anything in downloads?
Wiki Pathing Collation Tool!It would be possible to run a batch command in any folder that adds (appends) that folder to those to be scanned for in download folders. Even better would be to add this to the desktops file manager to get a r-click to select that folder. This iteration can also scan for subfolders.Neat idea! Like it!Yes?
- What you point to is some method / tool to more easily identify Wiki and get their paths into a settings file?
- I guess a standard "file picker" might also work? Maybe as part of a "configuration tool?" (I believe that might be possible via PowerShell? I just don't understand PS well enough to know how to do it).
TW Files With Extension ".TW"In windows at least a simple registry entry can associate .tw files with your default browser and clicking a tw file will open as usual in the browser. If this is done tw files could be placed in any folder with any files including other html files and you could even auto detect downloaded tw files and move them to a default folder.
With .tw files you could select your documents folder and it and all its sub folders could be scanned to locate .tw files to check for in downloads, and to identify where they beling. Again reducing the need for configuration.
I seen you mentioned the File Type ".tw" before in other threads. I think its interesting--as are many other of your ideas about leveraging the O/S & browsers to get a lovely system. Simple points ...
- The current PS1 script could be modified, I think, to accept a range of extensions eventually. Like .html, .htm, .hta, .tw ...
- In fact, I see no reason that it can't be totally agnostic about what file types it restores
Download NamingA recent change to tiddlywiki allows you to set the download filename before you download the first time. You could do this to ensure it is unique and maybe even name it to a .tw file. Then it would automagicaly be managed by the local scripts.
Useful info! I take a look.
Universal?Whilst these solutions aim to be universal we do need a different one for each operating system, so will it ever be universal?
My bad for not making clearer what I meant by "universal". I meant ...
- Working in alignment with the standardised download saving and save naming mechanisms that all modern browsers support
- In other words "universal" as "one standard method for any browser"
But you are right, that, if this approach, currently limited to a Windows scripting language (PowerShell) gets somewhere it would need writing in other platforms' script languages. But ...
- ... its not exactly settled yet what it is on Windows. Though the basic "restore" function is there and working. Other platforms later?
- Installation territory et al. Well that seems like "Repository" territory. Not there yet. The approach needs a lot more interest and input I think to begin to approach that.
Compatability with Existing TW Savers?A multiple os intaller could solve this. Having .tw files could make it possible to auto configure everything.Using the above should be compatible with timimi being installed because once it is running you just open the wikis and timimi handles the save and no download occurs. Timimi already works with .tw files.
This process should work along with tiddlydesktop and tiddlyserver as well
Yeah, the method using Mark S.' script at its core is compatible with other saving mechanism in TW. For the simple reason ...
- If you use a TW dedicated saver then no TiddlyWiki will get written to Downloads so co-existence with TW savers looks assurred.
- But, say you worked with a TW in Edge where normally you run in Firefox with Timimi ... You could use the "Nine-lives" script to restore the Edge edited version and just go back to Firefox and carry on from where Edge left off, no problem ...
- Basically the approach is Complementary to other methods of saving in TW. And its also Additive so you can include any browser brand. Using One method for all of them.
Tony, thanks very much for your very useful post. Please let me know if I misunderstood anything
Re the name, thinking maybe nein-lives (humour intended) or neun-lives just to avoid trademark infringement with the cat food company.
NINE-LIFE ?
... For example from a user perspective this is what I hope all they would need to know.
... I was thinking maybe "Polly", like the parrot that repeats itself, which is what the script really does.
The attached is just to indicate that some progress is being made.
So eventually, if we settle on "polly", for example, there might be 5 or more filespolly.txt (for usage)polly-vsn-initials.ps1 (the script)polly.ini (the settings)polly.bat (to launch with proper privileges)Get-IniContent.ps1 (library for parsing ini file)
polly-menu.batpolly-once.batpolly-auto.bat
Ciao Mark S.
PowerShell Permissions - InitialI wrote an experimental crude batch file that tries to deal with the two levels of permissions needed for PS script running. "Bypass" is relatively easy. "-executiion-policy" where it is "Restricted" needs explicit action to change it, and often, elevated priveledge.I'm doubtful about including the tool in a release.
I wrote it for testing permissions. And to quickly "Unblock" updated module you send me.
Anyway, its here in a very early iteration, if you are interested: https://drive.google.com/file/d/18Pr1ISSeWj_ZKmE8EluXihRRAexzab0g/view?usp=sharing
Best wishesJosiah
CurrentUser Unrestricted
;--- WHERE TRICKYDICKY LIVES
trickydicky=Barking
--- WHERE TRICKYDICKY LIVES
trickydicky=Barking
| UNBLOCK SCRIPTS
|
| Check the list of "Scripts Found" below.
| It should include "lib\Get-IniContent.ps1".
|
| If it does, click [U] to Unblock them all.
|
| [H] if you need further help (opens browser)
Scripts Found ...
polly-01d-TT.ps1
polly-01e-MS.ps1
lib\Get-IniContent.ps1
PS C:\Users\Mark\Downloads\polly-01e-MS> U
U : The term 'U' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ U
+ ~
+ CategoryInfo : ObjectNotFound: (U:String) [], CommandNotFoundExcepti
on
+ FullyQualifiedErrorId : CommandNotFoundException
? | Get Help (online), Unblock, return to Permissions, or Quit: [H,U,P,Q]?
? | Get Help (online), Unblock, return to Permissions, or Quit: [H,U,P,Q]?U
| Unblock completed. Hopefully you saw no error messages. | Unblock only shows information when it can't complete. | With no errors you should be good to go.
? | Return to Permissions, or Quit: [P,Q]?
--- WHERE TRICKYDICKY LIVES
trickydicky=Barking
TrickyDicky really came from ... Billericay
--- WHERE TRICKYDICKY LIVES
trickydicky=Billericay
https://www.youtube.com/watch?v=0jrkWygIqt0
Ciao MarkI wanted to log with you now that as this thing shapes its getting clearer to me it can be leveraged and add functions TW itself can't so easily do ...
Download saves enforce singular naming, so as a "surrogate central repository" of unique wiki it seems easy for modules to be added that don't just restore but also, for example ...
1 - Create a copy into a consoldated single BACKUPS folder that Timestamp the saved wiki with a time prefix of their last-write time2 - Restore to mutiple places (simply using a different ini, same method) for, say "My Uploads to the internet" (using an .ini that will monitor a directory you actually never edit the wiki in but do need updating regularly). Handy if you regularly need to update upload folders.3 - Create COLLECTIONS. In addition to Restore original, by having ONE directory into which a copy of the latest versions of a wiki is written. Again its not for wiki you actually edit, but its a place you can gather all you have ...Its a bit conceptually difficult at first?
But the point is "Downloads" become a de-facto HUB which can be used in many ways to support diverse need and copy them to unlimited destinations in diverse ways.
Its not just restore we talking about, I think??Hope this is clear!Its interesting!BTW, "POLLY" was a good suggestion on name by you! It works well ...
This is version polly-01f-MS.Changes:
* Permissions.bat is down in the dev directory -- for now
Actually, I think Windows 7 ships with Powershell 2.
So I must have already run some updates. It gets worse. Youcan have the same version of Powershell but on Windows 7 some of the commands may not do anythingbecause the framework code doesn't allow it (I don't recall which command ... probably something obscurelike determining mounted volumes).
Technically there's only 6 more months left of Windows 7 left, so the problem sort of fixes itself. I'm not fond of Windows 10.It feels like you're working on sort of garrish cross between the loser at the quilting bee and a pin ball machine.
I think if you right-click on the zip file and look at the properties you can unblock the zip file. Then everything that unzips from it will also be unblocked. I think. So just one unblock action required.
What do you mean by "auto creation of downloads" ?
I was vaguely thinking of working on zipped backups. Zipping is possible with 5.0. I would think anyone in a business environment will have PS 5. If not now, thencertainly in January 2020. Anyone with a home machine can upgrade for free.
It's been pointed out to me that when you install git from github, you also get a free bash shell. So it might be that the ultimate universal batch file solution may runin a bash shell. But the PS scripts could be used as a guide, especially the dialogs, where the code is nearly identical between systems.
Rather than have to have a browser open and an actual wiki you manually save I am using a Powershell zombie "touch" function to auto-create and update pseudo-wiki files in the downloads folder at regular intervals. At the end of a cycle it starts over. You can run it in parralel with the Polly scripts. I think it will ease testing. I just need to test a little bit longer before sending it you.
I was vaguely thinking of working on zipped backups. Zipping is possible with 5.0. I would think anyone in a business environment will have PS 5. If not now, thencertainly in January 2020. Anyone with a home machine can upgrade for free.Very good idea.I had thought that in addition to restore process it would be easy to have (a) "collections" where all the wiki in a settings file can be copied to a single folder (in adition to restore of original). (b) Same thing to one folder but with a prefixed time-stamp to make them a permanent version/backup rather than an over-write.
When its a big further on I want to see if what we did will work in PowerShell 6, which is cross-platform. If it does work in it it would be a further indication it could be converted for Bash I think.
TT: When its a big further on I want to see if what we did will work in PowerShell 6, which is cross-platform. If it does work in it it would be a further indication it could be converted for Bash I think.
Cross-platform? Really? What platforms is it going to work on?
.... "carrying coals to Newcastle" ?
polly-01g-MS... there is a message flashed on screen when the compression occurs. This comes from the PS utility itself. It might be possible to suppress that if desired.