Windows Scripting K2: VSearch Properties

Last Updated Apr 2009

By: Mark Bennett, Volume 2 - Issue 1 - June 2004

An old support adage is When you're sure everything is right, and it still doesn't work, something you are sure of is wrong.

Sometimes you'll find that a new program you are writing using the VSearch object in K2 is just not working the way you expect. Either it's not finding your Java classes, or the server isn't responding, and you'd really like to know what parameters K2 is using when it initiates the VSearch object.

Verity provides a handy API call: dumpSystemProperties. It shows you all of the properties currently active in the VSearch object, and may have just the information you are looking for to solve your problem.

Listing 1 shows a handy Windows Script Host utility that will list the output of dumpSystemProperties.

' Provided by New Idea Engineering Inc (http://www.ideaeng.com)' Copyright 2004 New Idea Engineering, Inc.'' Code and functions may be copied and used for your personal use ' or for your use in your company as long as the original copyright ' is included.'' For more information contact info@ideaeng.com

function trimCh(buf,ch)' trim character ch from string buf if in leading or trailing positions if(instr(buf,ch)=1) then ' leading position buf = mid(buf,2) end if if(instr(buf,ch)=len(buf)) then 'trailing position buf = left(buf,len(buf)-1) end if trimCh = buf end function

Once you've seen all the parameters VSearch is using, you can at least replicate the environment as you test your application.

Viewing the data file in Excel

Because the program uses a tab character to seperate the name - value pairs, you can redirect the output to a file, and then import that into Excel.

Run the program and redirect output to a file

cscript //NOLOGO proplist.vbs > csvfile.txt

Start Excel

Open the file (csvfile.txt in this example

Configure Excel to import using the tab character as the field delimiter

Re-Size the column

Note that if you give the file a csv extention, Excel will open the file but not treat the tab characters as column delimiters. Caveat emptor.

Done!

Caveats?

The script needs to be run on a system where Verity K2 is installed in order to have access to the VSearch object.

The properties retruned by dumpSystemProperties may change inthe future, or the call itself may be deprecated. Also, since unauthorized use of this script could expose configuration parameters you would rather keep private, use care to secure execution permission of the script to users and administrators you trust.

As mentioned, Excel will attempt to load the data file without any processing if you don't start Excel and open the data file. If you do not use the 'File|Open' menu, Excel will load the file without any tab delimiter processing. The same appears true if you name the data file with a csv file extension: keep to non-Excel-related file names and Excel will prompt you for the import.