Was looking for new and novel uses for the new COMable kixtart.dll that comes with the latest version. At least, something that could give an opportunity to play with it a little bit. Wondered how effective it would be as an embedded object in Internet Explorer. Kinda-like being able to script in vbscript and jscript from within HTML ... came up with the following ...

1) Download the lastest build and REGSVR32 KIXTART.DLL

2) Copy the following code to a new file called CONSOLE.HTA

 Code:
<html>
<head>

<hta:application 
 applicationname="KixtartConsole"  
 maximizebutton="no"
 minimizebutton="no"
 singleinstance="yes"
 border="dialog"
 scroll="no">

<title>Kixtart Console</title>

</head>

<style>
BODY
{
   background-color: buttonface;
   font-family: Helvetica;
   font-size: 10pt;
   margin-top: 10px;
   margin-left: 20px;
   margin-right: 20px;
   margin-bottom: 10px;
}

.button
{
   font-family: Helvetica;
   font-size: 8pt;
   width: 92px;

}

textarea
{
   font-family: arial;
   font-size: 10pt;
}

select
{
   font-family: arial;
   font-size: 8pt;
   width: 350px;
   margin-left: 0px;
}

td
{
   font-family: arial;
   font-size: 10pt;
}

</style>

<object classid="clsid:18F66832-6A94-4D70-B7EA-C51ACA6092A4" ID=Kixtart></object>

<body onload="Init()" >

<input type=button value="List Users" onclick="ListUsers();"/>
<input type=button value="List Groups" onclick="ListGroups();"/>
<br>
<textarea name=TextArea1 rows="20" cols="80"></textarea>

</body>

<script language="vbscript">

Function Init()

 Kixtart.SetVar "Document", Document
 Kixtart.SetVar "Window", Window
 Kixtart.SetVar "TextArea1", TextArea1

 Kixtart.RunScript ".\console.kix"

End Function

Function ListUsers()

 Kixtart.SetVar "Function", "ListUsers"
 Kixtart.RunScript ".\console.kix"

End Function

Function ListGroups()

 Kixtart.SetVar "Function", "ListGroups"
 Kixtart.RunScript ".\console.kix"

End Function

</script>    

</html>


3) Copy the following code to a new file (same directory) called CONSOLE.KIX

 Code:
Break On

Select

 Case $Function = "ListUsers"

  $TextArea1.Value = ""

  $WinNT = GetObject("WinNT://@WKSTA")
  $WinNT.Filter = "User",""
  For Each $User In $WinNT
   $TextArea1.Value = $TextArea1.Value + $User.Name + CHR(10)
  Next
  $WinNT = 0

 Case $Function = "ListGroups"

  $TextArea1.Value = ""

  $WinNT = GetObject("WinNT://@WKSTA")
  $WinNT.Filter = "Group",""
  For Each $Group In $WinNT
   $TextArea1.Value = $TextArea1.Value + $Group.Name + CHR(10)
  Next
  $WinNT = 0

 Case 0

EndSelect

Exit 0


4) Run the whole thing with c:\> console.hta

One thing I learned from using the new COMable Kixtart is that when you run a script using RUNSCRIPT(scriptname) method, it runs the script just fine. But you can't run the same script again (well, you can - but anything that can't be multiply defined errors-out, like defining UDF's)

So the script has to be kinda re-entrent (when used in this application).

Anyway, hoping anyone that wants to play and explore can think of even more novel things to do with the KIXTART.DLL

-Shawn