LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Windows Script Component (.wsc) methods from CVI

Hi,

 

I am trying to gain access to an already existing script that from Labwindows. It is a .wsc, Windows Script Component, file. It's in my System32 folder and I have registered it. The only way I could find to get the functions into labwindows was by generating a .tlb file from it using a windows utility. I then used the ActiveX control wizard in CVI to import the type library. The functions all seem to show up in the instruemnet panel. However, when I try get an automation reference I get an error (: error code= -2147467262). There is no dialog box or anything that comes up with this error code, I do error checking in my code and print them to my log, thats where I'm pulling the error code from. The problem is similar to what is described by the third post in this thread:

 

http://forums.ni.com/t5/LabWindows-CVI/How-to-integrate-windows-scripting-components-written-in-jscr...

 

Here is a reference to some info on WSC's:

 

http://msdn.microsoft.com/en-us/library/dd79w6c8(v=VS.85).aspx

 

Here is the call I am trying to make that fails:

 

error = JDDiag_NewAutomation (NULL, 1, LOCALE_NEUTRAL, 0, &JDDiag);

 

and the protype that the controller wizard generates from the .tlb:

/*-------------------- Prototype ---------------------*/

HRESULT JDDiag_NewObj (const char *Server,

                       int Support_Multithreading, LCID Locale,

                       int Reserved,

                       CAObjHandle *Object_Handle);       

 

Also, here is the code in JScript that would accomplish what I am trying to do in CVI:

  JDDiag = new ActiveXObject( "JDDiagnostic.WSC" );

  JDDiag.Init( objController );

 

If anyone has any ideas/knows what I am doing wrong, or if this is even possible please let me know. Also, the WSC is written in JScript, but I don't feel like that should matter because according to the Microsoft documentation they can be written in any scripting language and the COM should take care of things.

 

Thanks,

 

Josh Meyer 

 

 

0 Kudos
Message 1 of 1
(2,988 Views)