Powershell future

This is not because I need help this time! o) I hope you don't mind bringing this topic up again, I was looking for an older thread, but could not find that one.

Part #1:
I just want to ask you devs and creators, if there's anything on schedule for heaving powershell/.Net supported somehow. So do you?

It don't have anything to criticize on the current scripting capabilities of DO, it's real fun to use and greatly improving DOs versatility. But I think what's for sure is, that ActiveX and COM is getting old. You especially realize that when searching the net for ActiveX-Components and once you find what you're looking for, it exists for 32bit only - which is o(.

Personally I don't like the syntax and quirks of ps and could easily live on with jscript for another decade or directly use C#, but what .Net offers (powershell being a .Net wrapper more or less), is just awesome, you might agree on that. I'm not a C++ coder, I don't know how well these two worlds can be connected, but as Jon puts a lot of work in creating dedicated objects for DO, I wonder if this really is a future proof approach, as .Net/powershell would give you a binary file reader instantly, to give an example. The path object being another one, much of these things are actually already covered "on the other side".

I know you guys think before you start implementing things, but I know that special prototype of developer as well, who sticks to things he knows best! o))

Part #2:
In case you don't have an opinion on Part #1 yet, may I ask if its possible for you to run the DO scripting in STA-mode (single thread appartment)?
I played around with this powershell activex wrapper sapien.com/blog/2008/06/25/a ... e-download, which is a start, but to make full use of it, incorporating WPF-GUIs and dialogs (which might reduce work-load on you again, as custom dialogs are a breaze with WPF), the scripting part needs to run in STA-mode and not MTA (multi-thread-appartment).

I looked on how to get around this situation for myself.
[ul]
[li]You can get a powershell script to run in STA by adding a switch: "powershell.exe -sta -file myscript.ps1". That way you can make use of WPF GUIs, but running powershell.exe means running an external application, passing data back from these is knowingly hard and dowdy(?). Additionally it is slower compared to the next option.
[/li]
[li]I managed to compile and use a powershell cmdlet which creates an STA-Thread within powershell context to make WPF stuff run, but then things are getting complicated:
[ul]
[li]that posh-container from SAPIENS needs to be created inside DOs scripting context [/li]
[li]you need to add the new commandlet to the powershell context in the posh-container[/li]
[li]inject data/params from DO into the posh-container, so the powershell code to be run in STA can work with that[/li]
[li]run WPF code by the new commandlet [/li]
[li]get result out of the posh-container[/li]
[li]work on with that data in jscript [/li][/ul]
Code within DO may then look like this:



And the WPF window in this case:


This all is still somewhat manageable I think, but requires additional components to be installed (posh-container and cmdlet), while probably still being a bit too much for the average powershell-joe. Maybe we can get rid of the cmdlet to run things in STA, if DO could run scripting in STA mode by default? I don't know if that's something you can do on the C++ side, maybe. The most elegant way of supporting powershell/WPF, would be a native powershell host within DO of course. o)[/li][/ul]

Why I concentrate on this GUI thing here is again because I see you putting a lot of work in progress dialogs, windows, options and things to enhance the scripting experience. But you know best, you can't make things right for everyone, having a pool of dialogs available (just like script addins), to customize and build these ourself would dissolve existing limitations. A builtin powershell host ontop and there's little you couldn't do with DO connected to .Net.

Find the little WPF dialog attached here, it is fully functional and shall serve as an example on how easy it is to create and customize such things.
To run it: powershell.exe -version 2 -sta -file WPFWindowTest.ps1
WPFWindowTest.ps1.txt (3.24 KB)

This post got heavier than I wanted, but I felt like I need to ask and tell in detail! o)
Thanks for reading in every case. o)

In case anybody wonders, why I created such a wide textbox dialog, this is still ongoing process and investigation to fulfill a user request filed some days ago (tweak #4):

PowerShell seems more about providing ways to manage and automate programs from the outside than for providing ways to script and extend the functionality inside a program.

Yes it "seems", probably because there are a ton of cmdlets for managing apps. But you can also create a powershell context in your application and provide internal objects (DOpus, Script e.g.) to that. I assume it's basically the same way your doing things right now for interacting with WSH languages.

These 2 demo applications make use of powershell internally to let their GUI be changed by powershell scripting. For these simple demonstrations, things don't look difficult. Put any application object into the runspace and let the script act on it. In reality this is more complex I assume o), but the basic "how" is nice to see, especially in the video (2nd link).
leeholmes.com/blog/2006/02/14/msh-logo-–-allowing-users-to-extend-its-functionality/
dougfinke.com/blog/index.php ... plication/

Hosting anything to do with .Net inside a file manager is problematic, too. (Not insurmountable but a lot of work would be needed to run the scripts out-of-process.)

And WPF is an abomination. :slight_smile:

Because Opus fundamentally uses COM for OLE (drag&drop, clipboard, etc) we have always used the STA concurrency model - even when MTA would probably work, currently all threads in Opus are initialized as STA.

[quote]Hosting anything to do with .Net inside a file manager is problematic, too...
And WPF is an abomination.[/quote]
Ok and why? o)

Ok, good to know! I thought it was DO running MTA, if it's not, than it must be the ActiveXPosh thing itself and then there's no way around that additional cmdlet to switch back to STA again. Another short question: Those objects you lately implemented, File (-reader) for example, is it available for an external WSH script by ClassID/GUID or something? Could then make use of it somewhere else! o)

From your responses I then guess and self-answer my question: You're not planning anything powershell or .Net related at the moment.
Thank you. o)

No none of the objects are currently available externally (we don't have a typelib).