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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

About <strong>VBScript</strong><br />

Visual Basic Script Language (<strong>VBScript</strong>) is one of Microsoft’s scripting languages that is commonly<br />

associated with Server-side and Client-side web applications. However, Microsoft has opened up<br />

<strong>VBScript</strong> to developers and now <strong>VBScript</strong> can be found in a variety of applications. <strong>InduSoft</strong> has<br />

standardized on <strong>VBScript</strong> since it provides a significant subset of Microsoft Visual Basic’s functionality,<br />

and <strong>VBScript</strong> supports all of Microsoft’s operating system plat<strong>for</strong>ms including Windows CE, unlike VBA<br />

(Visual Basic <strong>for</strong> Applications) which cannot support the Windows CE runtime environment.<br />

<strong>VBScript</strong> is a programming language that is often viewed as a dialect of VBA (Visual Basic <strong>for</strong><br />

Applications), although it is really its own language. The <strong>VBScript</strong> language attempts to balance<br />

flexibility, capability and ease of use. VBA is a subset of Visual Basic that was developed to automate<br />

Microsoft Office applications, whereas <strong>VBScript</strong> was originally developed to support Server-side and<br />

Client-side web applications. Although <strong>VBScript</strong> and VBA provide many of the same features, there are<br />

some differences between them, primarily due to the applications they were each developed to support.<br />

So be<strong>for</strong>e we get into details of the <strong>VBScript</strong>ing language, perhaps it is worthwhile to review how<br />

<strong>VBScript</strong> is used with <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> (IWS) or alternatively, why <strong>VBScript</strong> is included with IWS.<br />

IWS provides an easy-to-use development environment that configures predefined objects to support<br />

an HMI/SCADA application. Applications can be built quickly and are relatively easy to support, even by<br />

someone other than the original developer. By comparison, programming languages such as Visual<br />

Basic can be used to develop an HMI/SCADA application, but the lower per-copy licensing cost savings<br />

quickly gets offset by much higher development costs and support costs. A programming development<br />

environment is clearly more flexible than a configuration development environment, but there is a<br />

significant cost associated with programming that makes it an unattractive alternative <strong>for</strong> HMI/SCADA<br />

applications. By adding <strong>VBScript</strong> support to IWS, <strong>InduSoft</strong> lets you chose between configuration and<br />

programming to meet your application needs and develop applications efficiently.<br />

Using <strong>VBScript</strong> With <strong>InduSoft</strong> HMI/SCADA Applications<br />

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> (IWS) supports both a simple, proprietary scripting language (worksheet style) using one<br />

or more Math worksheets, as well as <strong>VBScript</strong> (new with IWS Version 6.1). Developers can use either<br />

scripting language or a combination of both. <strong>VBScript</strong> code is placed in one of several modules, based on the<br />

functionality to be per<strong>for</strong>med and the scope of the code and its variables. This subject is covered more<br />

completely in the <strong>VBScript</strong> Configuration and Operation in IWS section.<br />

Examples of how <strong>VBScript</strong> can be used:<br />

• To execute a logic sequence or a routine when opening or closing a screen, or while the screen is open<br />

• To execute a logic sequence in the background<br />

• Run a simple VBScipt code segment based on an IWS object’s command dynamic<br />

• Interaction with IWS Tags and control of IWS built-in functions<br />

• Manipulation of ActiveX Controls and ActiveX Control event handler<br />

• Simple file I/O (e.g. text files)<br />

• Database interfaces (e.g. via ADO.NET), especially where use of SQL is required<br />

• Interface to Windows Management Instrumentation (WMI) and <strong>Web</strong> Services (via WSDL)<br />

• Interface to Microsoft Office applications (e.g. Excel, Access, Word) and Microsoft Office components<br />

via OLE Automation<br />

• Run on a <strong>Web</strong> Thin Client<br />

Where you should use IWS instead of <strong>VBScript</strong><br />

• User Interface. IWS does not support Windows Scripting, which typically provides the User Interface <strong>for</strong><br />

<strong>VBScript</strong> via Forms.<br />

• Device I/O (e.g. PLC communications). <strong>VBScript</strong> does not directly support serial or network<br />

communications.<br />

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

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

Saved successfully!

Ooh no, something went wrong!