TonyM wrote:
>
> 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.
>

Ciao TonyM

In trying to think through what would be useful for my use case I wrote a 
crude batch file that launches Mark's PS1 script ...

You will be able to inderstand it. It *won't generalise* as is as the *settings 
are currently hard coded* (but you can modify them at the start of the file 
if you want to test what it does).

---

After experimentation I determined that for the "Restore" method (I 
provisionally named "Nine-Lives" following a suggestion from Mark) I'd 
optimally want *on startup*...

   1 -- to see a listing of my wiki(s);

   2 -- to see a listing of files in the "downloads" folder (all .html & 
.htm)

   3 -- a way to alter the settings interactively (done crudely at the 
moment by opening the PS1 script in a text editor)

I thought you'd be interested. This is NOT meant to be anything but a set 
of rough ideas. 

I'm not sure that having a batch file in addition to a Powershell script is 
ideal. But its all I'm capable of. I think a single PS script would be 
best. Maybe with at BAT merely to ease launching it?

It invokes a very slightly modified version of Mark's PS1 script (which I 
will post seperately). The BAT & PS1 go in the same directory, which can be 
anywhere.

Take a look ... any thoughts?

@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%"


-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9450d4e9-7c8f-4f4e-ba44-4eb8b314433c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to