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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
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: 122
Function: loadPage

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

VDK - use existing vbscript code or libraries

Using existing vbscript code in the VDK

August 21, 2017Posted by Jason Ely

 

Odds are that if you are reading this, you most probably have some vbscript code laying around written pre VDK and you want to use that code in a program? No problem...the VDK has got you covered!

You can import any vbscript file into your current WSH namespace. Take a vbscript file and then import the file using the vdk import keyword. You can go read up on the VDK import function by visiting procedure vdk.lang.system. clsRuntime#import in vdk doc viewer

A practical example

A search on sourceforge for a vbscript library leads me to project VBSLib - VBScript Library. After downloading the project I get a zip file which when unzipped, has one .vbs file. If you drop the file somewhere in VDK HOME or one of its sub directories, you can view the file via VDK Doc Viewer:

External function library in VDK doc viewer

Unfortunately, you don't see any doc comments because the comments in the external function library are not VDK doc comment compliant. You do however get a listing of procedures in the function library and you can switch over to code view to read code in the file.

To use VSLIB, we just need to import the library and fire methods like so:

                                                            'The below code can only be executed in Wscript or CScript 
                                                            'as VSLIB library makes use of wscript procedure calls. 
                                                            'This will fail if you run it in an IDE like UFT or in an HTA

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

                                                            'import the VSLIB library
                                                            '
                                                            'if the library is somewhere along the VDK HOME path, I can import 
                                                            'it using the VDK path reference like so
                                                            import "library"

                                                            'if the VSLIB library is not somewhere along the VDK HOME path, 
                                                            'I can import it using its absolute path which for me is c:\vdk\library.vbs
                                                            '
                                                            'import "c:\vdk\library.vbs"

                                                            'get library description and library version
                                                            'from the VSLIB library
                                                            MsgBox LibraryVersion()
                                                            MsgBox LibraryDesc()
                                                        

It can't be that simple...there must be a "but" somewhere ...

I wish that the VDK could be awesome and magically import any and every external vbscript file/library but unfortunately, the VDK has to work within the confines of the vbscript language and compiler.

The import method will silently fail to import libraries/classes/files under the following conditions:

  1. The external file has a vbscript error.
  2. The external file causes a name redefined error. Consider, somewhere earlier you imported a clsTest class and now you try to import a different file but that file also has a class with name name clsTest. The 2 classes have different code and signatures but it has the same name and thats not allowed in vbscript. The same logic applies when functions with same name but different file paths try to get imported.

The vdk.lang.system.clsRuntime#import procedure in vdk doc viewer explains the limitations of the import method as well as ways on how to avoid common importing problems. If you are still curious, you can go google namespace collisions in vbscript.