A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 101

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 127

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$hooks is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$config is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$log is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$uri is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$router is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$output is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$security is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$input is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$lang is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$load is deprecated

Filename: core/Controller.php

Line Number: 78

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 82
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

VDK - getting started

On your marks, ready, go!

August 18, 2017Posted by Jason Ely

 

To get started with the VDK, download the installer from our download section. Install the VDK and take special care of the directory into which you installed the VDK. It is strongly recommended that you not install the VDK to "c:\program files" as executables such as vbscript files might experience permission errors when trying to execute. Rather install to "c:\" drive or some other location that will not cause windows permission errors.

Once installed, navigate to the VDK install directory. You will notice various vbscript files and directories. This location is known as VDK_HOME. VDK HOME is a system wide environment variable which you can view by opening your Environment Variables on Windows.

To test that everything installed correctly, open your favourite text editor, paste the below code into that file and save your file with a .vbs extension. Alternatively, you can run the below code in your favourite VBScript IDE like VBSEdit, Visual Studio, MSE7, UFT, QTP, etc. If you execute the below code, you should get a message box that says "VDK successfully installed."

                                                                'start VDK
                                                                ExecuteGlobal CreateObject("wsh.vdk.initialize").initialize

                                                                'Check if VDK core object has been created
                                                                if isobject(vdk) and lcase(TypeName(vdk)) = lcase("clsVdk") then
                                                                        msgbox "VDK successfully installed."
                                                                 else
                                                                        msgbox "VDK installation unsuccessful."
                                                                 end if

                                                        

Creating your own VDK scripts

When using the VDK in your code, you have to ensure that you explicitly start the VDK before you can start using VDK libraries. There are numerous methods that you can initialize the VDK but the preferred method is by writing one line of code at the beginning of your script/process as in the below example:

                                                                ExecuteGlobal CreateObject("wsh.vdk.initialize").initialize
                                                        

This initialization statement will go retrieve all necessary library dependencies and prep your WSH namespace with all the VDK prerequisites. If this line of code has executed successfully, you can then start using the VDK as per normal.

It is possible to start up the VDK process using other methods that give you more fine grained control but that is outside the scope of this tutorial. Visit our forum or see additional help docs for explanations.

Using VDK Libraries in your Scripts

The VDK comes with standard libraries out of the box. You can use these libraries in your own scripts by using the import statement in your scripts.

                                                                'Start VDK
                                                                ExecuteGlobal CreateObject("wsh.vdk.initialize").initialize

                                                                'import libraries I need
                                                                'I'm going to import the String library 
                                                                import "vdk.lang.clsString"

                                                                'create object from imported library
                                                                set objString = new clsString.init("Hallo World")

                                                                msgbox objString.toString()
                                                        

When importing VDK libraries, you use a dot separated string to indicate the path to your library. In the example above, we are telling the VDK to go to the VDK_HOME directory, find a directory called VDK, in that directory find a directory called lang and in that directory, find a file called clsString.vbs. If the file is found, the vbscript file contents are added the the current WSH namespace after which you can use the class/library.

You can also import multiple libraries in one statement using asterisk [ * ] like so:

                                                                'Start VDK
                                                                ExecuteGlobal CreateObject("wsh.vdk.initialize").initialize

                                                                'import libraries I need
                                                                'Instead of importing libraries 
                                                                'one at a time, I'm going to import everything 
                                                                'in the VDK package  
                                                                import "vdk.*"

                                                                'create object from imported library
                                                                set objString = new clsString.init("Hallo World")
                                                                set objBoolean = new clsBoolean
                                                                Set objSimpleDateFormat = new clsSimpleDateFormat

                                                                'create as many objects as you want from libraries in VDK package ...
                                                        

Class and function library importing is a complicated subject in the VDK and that's why there is a tool that you can use which will make library importing and usage much simpler. That Tool is VDK Doc Viewer which is covered in the next section.

VDK Doc Viewer

The VDK is fully documented inside its code by means of VDK Doc Comments. The Doc commenting system is modelled after the JAVA doc system.

If you are using the VDK, you can leverage the power of VDK Docs by using the VDK Doc Viewer program. To use, download the installer from our downloads section. To run the program, you will require Java JRE 1.6 or later to be installed on the client machine. Once successfully installed, you will be able to view all VDK library information in a simple to use HTML format.

All VDK classes and libraries are managed as a directory system which the VDK calls packages (directory) and members (file). Hence you can navigate the VDK home directory until you find a vbscript file/library that fits your needs. If you select the library, VDK Doc Viewer will give a summary of the library including:

  • Class/Function library name: If the library contains a class, then the class name will be displayed. If the file is a vbscript function library, then the file name is displayed.
  • VDK Path Reference: the VDK path to the library. This is the value that you will copy to use in your VDK import statement.
  • Class description doc statement (if one has been document)
  • A listing of vbscript constructors and destructors as well as VDK constructors
  • A listing of all public procedures for the library
  • A method summary for each public method including method description, author, version, parameters, procedure return types, procedure parameter requirements, etc.
VDK Doc Viewer

So, if I wanted to use the clsProperties vdk library, I would navigate to vdk/utils/properties/clsProperties in vdk doc tree view (see screenshot above). Once selected, if will give me a summary of the libraries capabilities which I can use in a script like so:


                                                                'Start VDK
                                                                ExecuteGlobal CreateObject("wsh.vdk.initialize").initialize

                                                                'import properties library. I got the import path from VDK path reference field in VDK Doc Viewer
                                                                import "vdk.utils.properties.clsProperties"


                                                                'create object from imported library
                                                                'I got class name from VDK Doc Viewer as well
                                                                'we'll need a properties file. You can create one by creating a new text file 
                                                                'and saving it as test.properties
                                                                'in the file add the following:
                                                                'name=Jason
                                                                'surname=Ely
                                                                '
                                                                'save your file

                                                                'create an object from library
                                                                'notice init keyword after class name. This is a VDK pseudo constructor which 
                                                                'is explained in VDK doc viewer
                                                                set objProperties = new clsProperties.init("c:\temp\test.properties")

                                                                'Looking at VDK Doc Viewer for this library, you can 
                                                                'decide on which methods you want to use.
                                                                'I'm going to use methods to retrieve property values
                                                                strName = objProperties.getPropertyValue("name")
                                                                strSurname = objProperties.getPropertyValue("surname")

                                                                msgbox "My name is " & strName & " " & strsurname

                                                        

Conclusion

If you have used a programming language like Java or C#, you'll be getting a distinctly deja vu feeling. For those who have not, just remember, the VDK is still VBScript at the end of the day.

If you want to continue your VDK learning journey, the best way to actually understand is to actually have a look at the VDK programming examples or VDK Unit Tests.

If you are still feeling adventurous and you have Visual Studio or MSE7.exe installed, you take some sample VDK code, save that in a .vbs file and via shell execute the file in debug mode which will allow you to step through the VDK library line by line.

                                                            wscript "path\to\your\vbscript\file"  //x //d