This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Getting Started with Kiwi CatTools API

Is there a tutorial for getting started with the CatTools API? I'm finding the documentation in this area to be somewhat lacking. From the 9.1 Environments section:

In the VBA menu Tools/Reference select "Kiwi CatTools API" from the available references. 

Is this instruction speaking to how to setup the MS Visual Basic Editor? The 8.1 Script Editors section mentions that any script editor will do, however, basic text editors don't have the functionality to reference an external library. Where is the "Kiwi CatTools API" DLL (library) on the filesystem?

Given the 9.2.1.1 Sample Code used to establish a connection to the CatTools database via it's API. The the first variable in this script is cast as a CatToolsAPI.Database. How do you reference the "Kiwi CatTools API" library so that this script may cast this type of variable?

Dim DB As CatToolsAPI.Database 
Set DB = New CatToolsAPI.Database 
DB.EncryptionPassword = "MyPassword" 
If DB.OpenConnection Then
MsgBox "Connected ok" 
Else 
MsgBox "DB connection failed: " & DB.ErrDescription 
End If 
DB.CloseConnection 
Set DB = Nothing
  • The Script editors section 8.1 under the Custom scripting Chapter 8 section is with respect to creating device and activity custom scripts.

    The CatTools API does not form part of the custom scripting facility in CatTools which is why it has been written as a separate chapter in the help file.  The CatTools API is only available to licensed customers (i.e. not Freeware users).   If you create an application or code that uses the CatTools API, then you can only run this on the system where CatTools has been installed, as it needs to read the CatTools license details in order to work.

    Because of the capabilities of the CatTools API (i.e. it can modify device data in the CatTools database), it is assumed that a person using the API would have a reasonable knowledge of Visual Basic programming skills and so probably be familiar with the Visual Basic development environment, for example Visual Studio; or alternatively knows how to utilize the VBA programming environment (Visual Basic editor) within MS Office applications.  This is why the API sample code is written in VB/VBA form.  In these development environments, you can add a reference to the CatTools API called "Kiwi CatTools API".  Once the reference has been added, you should be able to simply copy and paste the sample code from the CatTools API help pages into your VB project and it will work.

    However, if you are using a text editor (such as Notepad), you won't be able to add a reference to the CatTools API as you have found.  For text editors, you need to change the code slightly to use the 'CreateObject' function to reference the CatToolsAPI available classes.

    For example:

    Dim DB
    Set DB = CreateObject("CatToolsAPI.Database")

    would be used to replace the code in your sample above of:

    Dim DB As CatToolsAPI.Database
    Set DB = New CatToolsAPI.Database

    You can then save the text file as a VBScript (.VBS) file and run it.

    In order for the API code to work, the CatTools API library file (Cattools.dll) must be registered on the system correctly, which you can do using the following from the START > RUN dialog:

    regsrv32 "C:\Windows\system32\cattools.dll"

    Hope this helps.

    Steve

  • The command listed above to register the .dll "regsrv32" just needs to be updated to "regsvr32".  The r and v just needed to be switched around.

    regsvr32 "C:\Windows\system32\cattools.dll"

     

    Marcus

  • Steve,

    Thanks much for the full explanation. The filesystem location and name of the dll is really what I was missing here (I should have better phrased my inquiry). Your examples and identification of the CreateObject caveat is great. We'll give her a go and let you know how we come along.

    Thanks,
    Lee

  • Hi Marcus,

    Many thanks for spotting my typo error.   I like to throw one in every now and again to ensure my audience are listening...   (he says - while trying to pull the wool over...)   ;o)

    Steve

  • You are welcome Lee.  Look forward to hearing how things turn out.

  • Steve,

    I may be doing something wrong here. I'm running into an error after adding the CatTools.dll as a reference in my VB project (see attached screenshot). As you can see, I'm using Microsoft Visual Basic 2008 Express Edition. I have the Add Reference screen open and after clicking OK to add the reference am getting the following pop-up error. 'Tis a shame Visual Basic doesn't give a more descriptive error. Can you point me in the right direction here? Are you available to chat either via instant messenger or voice?

    Gtalk: leecalcote
    AIM: lcalcote5343
    VOIP: 1 (512) 340-3159 CST

    Thanks,
    Lee

  • Hi Lee,

    Unfortunately I don't have Microsoft Visual Basic 2008 Express Edition to test on, however I've tried add a reference within Visual Studio 2008 and it works fine (I tried this after installing CatTools v3.3.11 which I'm guessing is the same version you are running based on the CatTools.dll version shown above.)

    This would then suggest either its an issue with the dll (maybe try uninstalling CatTools and reinstalling it to see if this fixes the CatTools.dll), or an issue with Microsoft Visual Basic 2008 Express Edition not being able to reference a COM dll?

    Can you maybe try the VBScript approach I mentioned above (using say Notepad.exe) to make sure that you can at least use the API classes successfully?

    Finally, are you using a licensed version of CatTools or the Freeware edition?  The Freeware edition can't use the CatTools API as it requires the same full Kiwi CatTools license in order to work.

    Steve

  • Steve,

    We've been successful in making API calls. I appreciate your help. From the API documentation, I see that we're able to work with the Devices, Device Groups and Device Types. Does the API provide functionality to interact with Activities? For example, we'd like to use the API to modify the Device.CLI.Send Activity type.

    On another note, when making API calls, do we need to ensure the timer is stopped? We're wondering about this since when working with the UI, you need to stop the timer before the bottom toolbar (Add, Edit, Remove, Copy, etc) becomes available.

    Thanks,
    Lee

  • Steve,

    I'm wondering if you can assist me in regard to this issue: Solarwinds Case # 88273. I've had this case open since Monday and have yet to receive a callback. Could you assist in escalating this issue? Your assistance on this forum inquiry has been wonderful. I'm looking for the same support in real-time.

    Thanks,
    Lee

  • Lee,

    Glad you've got the API working.

    Currently the API will only work on updating devices or device related data.   There are no activity related public classes available within the API to modify activities.

    When you say you want to use the API to modify a Device.CLI.Send commands activity, are you wanting to modify the commands that the activity is sending to the device(s), or modify something else?  If it’s just the commands, then I'd recommend taking a look at the on-line Help file page: http://www.kiwisyslog.com/help/cattools/act_devclisendcmd_setup.htm   You may be able to use the 'Or, read command from a file:' option to read in different sets of commands form different files by utilizing the command variables (Meta variables) that get translated at run-time.

    Steve