Query: POWERSHELL for TW: anyone doing anything?

183 views
Skip to first unread message

TiddlyTweeter

unread,
Jan 7, 2021, 4:53:35 AM1/7/21
to TiddlyWiki
Having worked with Mark S. on POLLY (A very useful Powershell tool to save & backup TW and more). 

I am very aware of the utility of Powershell to get things done. And "Powershell Core" is now multi-platform (all except Android natively).

The QUESTION here is whether any of you are using Powershell to help support TW in interesting ways?

Just an initial query,
TT 

TW Tones

unread,
Jan 7, 2021, 6:19:34 PM1/7/21
to TiddlyWiki
TT,

PowerShell is but one standard of command line use. I tend to make use of the windows command line and batch commands from TiddlyDesktop since as an app TD has local access. 
  • I Have experimented to see how far I could go with desktop automation and it is a long way, but now I tend to "live inside my browser and tiddlywiki" I have neglected this area.
  • It seems to me TiddlyWiki with local access is ideal platform for training tips and hints even batch file generators for desktop and process automation etc..
  • Generating custom HTML pages that can be placed in folders for local utility functions, or LAN access is also a possibility.
  • So yes, PowerShell and its compatible platforms such as Office 365 has much potential.
Tones

Mark S.

unread,
Jan 7, 2021, 11:26:17 PM1/7/21
to TiddlyWiki
On Thursday, January 7, 2021 at 3:19:34 PM UTC-8 TW Tones wrote:

PowerShell is but one standard of command line use. I tend to make use of the windows command line and batch commands from TiddlyDesktop since as an app TD has local access.

That sounds interesting. Is there some documentation on how to launch from TD?

I think Powershell has a potential to make some inroads towards being a universal batch language. There's all these shell batch languages that look very similar, but have different libraries and subtly different syntax. I found this out the other day when trying to run a Posix script on my linux system. Of course there are full-blown programming languages like python and java that are universal, but more complicated than most people want for simple file manipulation and command launching. Perhaps I've missed some developments in the original Windows command shell, but the last time I tried it was much harder to make complex if/then decision trees and subfunctions. I wouldn't be surprised if MS replaces the windows command shell with Powershell entirely some day.


TW Tones

unread,
Jan 8, 2021, 12:16:08 AM1/8/21
to TiddlyWiki
Mark,

In the past I was a batch file guru. I must admit tiddlywiki with all its complexity is easier to use than batch files, but last time I tried I could use DOS commands like a pro, Although this could be the memory of skills lost. 
  • Complex if/then decision trees and sub functions all possible in batch files, but sometimes fiddly. 
  • I used to write advanced "Basic" programs as input filters and more back in the day, or even exe batches.
In short if you are using TiddlyDesktop a link to an exe, file or folder will be as if you typed from the command line.

<a title={{!!tooltip}} href="file:///C:\Data\batches\runnetworkcheck.cmd" > Go</a>  Run
[[file:///C:\Data\batches\runnetworkcheck.cmd]] Run
[[file:///C:\Data\batches]] Open folder in Windows Explorer

To review the contents of a file I used

<$button set="Networkcheck!!last-refresh" setTo=<<now "0hh:0mm">> >
Refresh {{Networkcheck!!last-refresh}}
</$button>

<object width="100%" height="930" data="file:///C:\Data\batches\networkcheck.txt"></object> 

  • Of course you can do the same to execute PowerShell scripts.
  • I found a way to generate batch/command files and print them to the generic text printer and saving the batch, all that's left is to execute.
  • You can also write smart batches that monitor for the existence of a file and it it exists, execute or process it, so you need only save the file to have it processed.
Regards
Tones

TiddlyTweeter

unread,
Jan 8, 2021, 5:10:40 AM1/8/21
to TiddlyWiki
Ciao Mark S. & Tones ...

TW Tones wrote:

PowerShell is but one standard of command line use. I tend to make use of the windows command line and batch commands from TiddlyDesktop since as an app TD has local access.
 
Mark S. replied: 
That sounds interesting. Is there some documentation on how to launch from TD?

 Just FYI, TDesktop supports OS launch as Tones reply indicates, I assume its "nodeish" under the shell? Bob does it very well indeed, with it likely leveraging the OS at will in the most transparent manner. The FYI part is that the previous version of Timimi saver plugun ALSO supported O/S script launch from Firefox! The latest version, the one that included support for Chrome, doesn't, unfortunately, support it at all now. I might ask Riz again if it could again be supported--it was very useful.

I like that one could, for instance, launch and control POLLY (Powershell) from a TiddlyWiki!

Best wishes
TT

Mark S.

unread,
Jan 8, 2021, 11:33:36 AM1/8/21
to TiddlyWiki
Hi Tony,

I just threw out a bunch of MS-DOS books in the garage from back in the day. There were still some 5.5 inch discs stuck between the pages.

I think if you peruse the PowerShell documentation a bit, you'll see that it more closely resembles a complete programming language. It also has a richer set of tools that will let you learn things about the operating system's memory and resources. Of course, with great power comes a great need for authentication, so there are some extra road-bumps to running it.

Thanks!

On Thursday, January 7, 2021 at 9:16:08 PM UTC-8 TW Tones wrote:


Cade Roux

unread,
Jan 8, 2021, 1:42:30 PM1/8/21
to TiddlyWiki
I use Powershell extensively in our data warehouse build and deploy process.  And that includes importing TW "templates", importing tiddlers from a JSON file generated from the database in SQL procs, exporting the whole file to HTML.  We use it for the user documentation generation as well as somewhat interactively in the QA process, where the informatics staff can review the test output results and check off that they are correct - these tiddlers get imported so that they can round-trip in future build/test cycles.

Doing all this using tiddlywiki nodejs command line.

Thanks,

Cade

TiddlyTweeter

unread,
Jan 8, 2021, 3:21:16 PM1/8/21
to TiddlyWiki
Ciao  Cade Roux 

Thanks for the detail! It is a very interesting case usage of PS with and for TW.

Basically you give an example that illustrates the relevance and utility of TW/Powershell co-working.
 
Best wishes
TT

TiddlyTweeter

unread,
Jan 8, 2021, 3:27:07 PM1/8/21
to TiddlyWiki
Mark S. wrote:
I think if you peruse the PowerShell documentation a bit, you'll see that it more closely resembles a complete programming language.

Right. It certainly directly supports an enormous number of utility functions seamlessly. In my own case I use it in, for instance, a simple three step process ... 1) connect to web and download a file; 2) use PS regex to parse and modify the downloaded file; 3) prep it for import into TW ...

Simple example
TT
 

TW Tones

unread,
Jan 8, 2021, 6:26:15 PM1/8/21
to TiddlyWiki
Mark,

I know powershell has more exhaustive and integrated features that make it a language on its own, all I ask is for you realise that "back then" we had similar needs to today and we always found a way to do it. Writing batch files that make use of the sysinternals executables as an example, it is some ways was a time where where hacking the system to make it do what you want was an everyday game. In fact reducing the need to hack and provisioning the features in Powershell came from the experience of those before it.

I may be getting older but even before I was, I recognised that many things have already being invented and each generation needs to reinvent in their own terms. Thus if we avoid ageism we stand to benefit from those who went before us. We all strive for novelty and invention but we do not always know when it is truly original or new. Ageism also tells us there is value in the fresh look we get from the young and even naïve.

My Grandfather was a Radio engineer from the early days of radio, he built for my dad the first remote control toy in Australia, a boat. I have a book of his, in it we see lessons from his experience, that people still relearn every decade or so. 

Even with looking back into the deep past such as the Australian Aboriginal people, we always underestimate their skills, knowledge and experience to survive as they did. After all they had the same capabilities as current humans its only their academies were the land and their lives. One notable case is how we look back with todays eyes, for example a Christian, views non-Cristian world views, as  less advanced but how can we test this?, an atheist looking back is inclined to judge much in the past as superstitious, when the people of that time perhaps knew they were only metaphors, but they were useful ones. 

Youth is wasted on the young, and the young waste the value of their elders, and later become elders themselves, only then do they learn the meaning of this sentence.

Tones

TiddlyTweeter

unread,
Jan 9, 2021, 8:18:51 AM1/9/21
to TiddlyWiki
Ciao Tones & Mark S.

Just a little footnote on Tones appreciation of Le ".bat/.cmd" thingies.
I certainly agree in past it was common to use them to co-ordinate the invocation and returns of small additional utilities not in the Command Processor suite directly. And thereby better enable end-user needs.

But you can still do that on Windows. In fact you can launch Powershell that way and get it to interwork with other tools with "Mr .Bat" in control :-) if you needed to. So it is not exactly an either (Powersell)/or (Bat) situation.

The thing with Powershell (Core) is it is cross-platform (though PATHING particularly you have to understand in a universal way to avoid platform specific snafus).

Best wishes
TT
Reply all
Reply to author
Forward
0 new messages