Tuesday, May 5, 2009

Blending Languages and Stoopidity

I thought the following chunk of code would work, but it doesn't.  Not sure why, but I'm told there will be a new KiXtart.dll released with KiXtart 4.61 at some point.  I registered the DLL using "regsvr32 kixtart.dll" with the DLL file sitting in C:\.  The 4.60 version of the DLL works fine with VBScript, but not from PowerShell 2.0 (at least not running on a Windows 7 client)

$kix = New-Object -ComObject KiXtart.Application

But the $kix object returns nothing but a crap-filled $error object.

I was happy to see that I can still invoke the ScriptControl object and martial a Jscript object to do some dumb tasks, like calculating the Cosine of 30.

$objSC = New-Object -ComObject ScriptControl
$objSC.Language = "jscript"
$result = $sc.Eval("Math.cos(30)")
$objSC = $null

returns:  0.154251449887584
Post a Comment