Forum Discussion

WestManBruce's avatar
WestManBruce
New Contributor
8 years ago
Solved

VBScript error with CreateObject

Hi Everyone, I wrote a vbscript that's functions through command line. So i tried transfering it to testcomplete as a script and it keeps failing at "set imap = CreateObject("Chilkat_9_5_0.Imap")" with the following error "ActiveX component can't create object 'Chilkat_9_5_0.Imap'" please see the snippet of code below

 

Dim fso Set fso = CreateObject("Scripting.FileSystemObject")

set imap = CreateObject("Chilkat_9_5_0.Imap")

success = imap.UnlockComponent("Test")

 

Any help would be greatly appreciated

  • HKosova's avatar
    HKosova
    8 years ago

    Chilkat DLLs have 32-bit and 64-bit versions. Which one do you have installed? TestComplete is a 32-bit app, so it needs the 32-bit version.


    I've tried and installed the "Chilkat 32-bit ActiveX MSI Installer" (on Windows 7 64-bit). Both

    CreateObject("Chilkat_9_5_0.Imap")

    and

    Sys.OleObject("Chilkat_9_5_0.Imap")

    work fine:

     

    So, make sure you have the 32-bit version installed and that it's registered properly (maybe rerun the registration as admin).

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    CLR Bridge in TestComplete is intended to interface with .Net objects and classes which are created using their constructors but not CreateObject function.

    CreateObject function is provided by VBScript and, while you can use it in TestComplete, the recommended replacement is Sys.OleObject() one. Sys.OleObject() function creates an instance of COM object (provided by some .dll or .ocx binary) and in order the object can be created, its containing .dll must be registered in the system. To register your COM object in the system execute this command from the command prompt:

    regsvr32 <FullPathToCOM.dll>

    • WestManBruce's avatar
      WestManBruce
      New Contributor

      Thanks for the help, unfortunately i haven't made much progress. Dll must be registered since it works fine when the VBScript is run outside the testcomplete application. I ran the register command again just to make sure.

       

      If i try

      Set imap = Sys.OleObject("Chilkat_9_5_0.Imap")

       

      I get the following error now. "Class not registered, ClassOD: {CEDB6B70-ED7D-4F9E-A0BC-66AFB42F7735}"

       

      Again, thanks for your time as this is causing me a bit of a head ache.

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        Chilkat DLLs have 32-bit and 64-bit versions. Which one do you have installed? TestComplete is a 32-bit app, so it needs the 32-bit version.


        I've tried and installed the "Chilkat 32-bit ActiveX MSI Installer" (on Windows 7 64-bit). Both

        CreateObject("Chilkat_9_5_0.Imap")

        and

        Sys.OleObject("Chilkat_9_5_0.Imap")

        work fine:

         

        So, make sure you have the 32-bit version installed and that it's registered properly (maybe rerun the registration as admin).

  • sanjay0288's avatar
    sanjay0288
    Frequent Contributor

    Hi,

       Going through your post now I understand that you are using a third party .dll or .ocx file. Have you registered that dll in testcomplete?

     

    Can you follow the below steps to make sure the component is registered

    • Launch TestComplete ->Open your project Suite
    • Navigate to Tools -> Current Project properties -> CLR Bridge
    • There is an option to Browse GAC files select that option and wait till the tool enumerates the available GAC'S. In the registered components list search for your 3rd party dll. Select the checkbox and click ok.

    The second option is to

    Select browse ->Files Option ->Navigate to your DLL location and select the dll.

     

    Once you have registered your dll you can access the methods using .Net assemblies.

     

    Please refer to the link below:

    Hope this might be of some help :)