18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

<strong>VBScript</strong> Hosting Environments<br />

While much of the material contained in the document covers the <strong>VBScript</strong> language and its use <strong>for</strong><br />

IWS applications, it is important to understand conceptually how <strong>VBScript</strong> works in an IWS environment.<br />

If you browse the web <strong>for</strong> in<strong>for</strong>mation on <strong>VBScript</strong>, you will likely find a plethora of in<strong>for</strong>mation, but<br />

many of the examples are <strong>for</strong> running <strong>VBScript</strong> with ASP using the Windows Scripting Host.<br />

<strong>VBScript</strong> was developed using a Microsoft technology called ActiveX scripting, which is a COM-based<br />

specification that allows the development of runtime engines <strong>for</strong> virtually any scripting language. Other<br />

scripting languages include JScript. <strong>VBScript</strong> can create an instance, or instantiate, a COM object, and<br />

thus through <strong>VBScript</strong>, many system features can be controlled such as ActiveX Controls, the<br />

FIleSystemObject (providing access to the Windows file system), Microsoft Office Automation (COM),<br />

and ActiveX Database Objects (ADO).<br />

The <strong>VBScript</strong> Scripting Engine runs on a host, and there are several hosts that can run <strong>VBScript</strong> (or<br />

any ActiveX Scripting-compliant engines) including Windows Scripting Host and Microsoft Internet<br />

Explorer. <strong>VBScript</strong> can be used in conjunction with Windows Scripting Host (WSH) to automate system<br />

administration tasks. WSH is part of the Microsoft operating system and treats a <strong>VBScript</strong> application<br />

like a powerful batch file. <strong>VBScript</strong> applications can also be found with <strong>Web</strong>-based shell views. Most<br />

frequently, <strong>VBScript</strong> is used with Active Server Pages (ASP) <strong>for</strong> Server-side web applications and<br />

Microsoft Internet Explorer <strong>for</strong> Client-side web applications.<br />

Stating with Version 6.1, IWS is now a host <strong>for</strong> the <strong>VBScript</strong> Scripting Engine. When used in<br />

conjunction with IWS, IWS becomes the only host <strong>for</strong> the <strong>VBScript</strong> Scripting Engine that is used. WSH<br />

is not used by IWS, even though WSH may be resident on the PC running the IWS application.<br />

<strong>InduSoft</strong> has placed implemented <strong>VBScript</strong> host environment in a manner that is logically consistent<br />

with the current IWS application development environment and licensing method. What this means is<br />

that there are multiple locations in the development environment where <strong>VBScript</strong> code segments can<br />

be located (so the code is located close to its use), and restrictions placed on the scope of procedures<br />

and variables. In IWS, there is no such thing as a Global Variable that is accessible by any <strong>VBScript</strong><br />

code segment. The IWS tags and built-in procedures can be accessed by any <strong>VBScript</strong> code segment.<br />

The restrictions and interaction with IWS tags and built-in functions implemented by the IWS <strong>VBScript</strong><br />

Host are covered in more detail in the VB Configuration and Operation in IWS section.<br />

The <strong>VBScript</strong> Scripting Engine per<strong>for</strong>ms a few key functions. It per<strong>for</strong>ms syntax checking in the<br />

development environment (e.g. right mouse click on a <strong>VBScript</strong> Interface, then select Check Script). It<br />

also interacts with IntelliSense, an auto-completion tool that provides reference to available functions<br />

(<strong>VBScript</strong> and IWS), IWS tags and ActiveX Controls (name, Properties and Methods). And most<br />

importantly, it executes the <strong>VBScript</strong> code at runtime, providing error messages if an error occurs. It<br />

should be noted that unlike most programming languages, <strong>VBScript</strong> is not compiled; it runs in an<br />

interpreted mode. The <strong>VBScript</strong> Scripting Engine (vbscript.dll) is responsible <strong>for</strong> interpreting (via the<br />

<strong>VBScript</strong> Parser, a part of the <strong>VBScript</strong> Scripting Engine) and executing the <strong>VBScript</strong> statements, and it<br />

does so quite efficiently. IWS uses Version 5.6 or later of the Microsoft <strong>VBScript</strong> Scripting Engine.<br />

There are no limitations on the number of <strong>VBScript</strong> variables supported in IWS, however the amount of<br />

storage <strong>for</strong> <strong>VBScript</strong> variables is determined by the amount of memory available in your system.<br />

<strong>VBScript</strong> variables do not count against IWS tag limits <strong>for</strong> licensing purposes.<br />

10 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!