As I released the possibility to run HTA-type applications with Invoke-HTApp yesterday you might have guessed that I would release a New-SelfHostedHTApp? Well, I did. The self-hosted HTApps can run without any of my own libraries (just as the self-hosted ps1 files you can produce with New-SelfHostedPS) as EXE, signed or not… a new video of all the self-hosting options I have will be released within a couple of days at youtube.. but while you wait download the lib and make your own self-hosted HTApp…
If you do you have probably been around a while. But I hope you remember how good HTA was as a quick solution to prototyping or to just make those small quick applications? Anyhow, just a few days ago I was talking to a collegue in my Company complaining about how hard it was to build small forms based applications in PowerShell. Even if there is alot of designers, helpers etc to create it still makes you need to think and now deverloperish stuff. He then said the magic words and asked if he could use PowerShell in HTA. Well you cannot, but I have created the second best thing. A Cmdlet that will parse and execute any HTApp file (kind of a HTML but with some PowerShell in them). That makes it very much easier – if you know some basic HTML you will be able to prototype any application.
The feature have been packed into a new module in my PowerShell library (Sorlov.PowerShell.HTApps). It does require that you have the Sorlov.PowerShell.SelfHosted file and also that you are NOT running on a core-install of Windows. Here is a very breif description. Also as a notice/reminder consider this module yet as NOT production stable as it has not yet been very well tested! I have attached a few very basic examples of a couple of HTApp scripts to get you started.
$App which can control the lifecycle of the application and some system events.
Int Title The window title
Int Width The width of the window
Int Height The height of the window
Int Top Placement of the topmost border of the form on the screen
Int Left Placement of the leftmost border of the form on the screen
Void Reload Reloads the current application
Void LoadApp(string) Loads another application
Void Exit Exits the application
Void ExitObject(object) Exits the application and returns Object on pipeline
string InvokeScript(string) Runs a statement and returns string
Void InfoMessage(string) Shows a asynchronous message (Info Icon)
Void WarningMessage(string) Shows a asynchronous message (Warning Icon)
Void ErrorMessage(string) Shows a asynchronous message (Error Icon)
$Document which is the standard HTMLDocument (as described in http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.aspx) for the application currently loaded.
As always the library installer can be found here: http://sorlov.azurewebsites.net/page/PowerShell-Projects.aspx