Pages

Friday, 21 June 2013

Create simple GUIs to your scripts - HTA files

While looking for a way to help my grilfriend be more productive I found ut that one can create hta files. The following example is with VB. I have to see if it is possible to use other kind of scripts.


<head>
<title>HTA Test</title>
<HTA:APPLICATION
APPLICATIONNAME="HTA Test"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>

<script language="VBScript">
Sub TestSub
Msgbox "Testing 1-2-3."
End Sub

Sub GetOSVersion
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" &strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
Msgbox objOperatingSystem.Caption &" " &_
objOperatingSystem.Version
Next
End Sub
</script>

<body>
<input type="button" value="Run Script" name="run_button" onClick="TestSub"><p>
<input type="button" value="Get OS Version" name="run_button" onClick="GetOSVersion"><p>

</body>

This may turn out to be useful once or twice. But I would hate to have to program in visual basic.
There was actually an example how to create a simple selection list in powershell. But I have not tried the described there, but the page might be useful to you