Title: VBScript
1VBScript
2Microsoft Visual Basic Scaleable Solutions
- Visual Basic
- Best tool for distributed client/server solutions
- Powerful, robust, scaleable
- Creates ActiveX Controls and documents
- Visual Basic for Applications
- More sophisticated application scripting
- End-user focus, natural upgrade, superb
integration - Part of Office 97 and widely licensed
- Visual Basic Scripting Edition
- Great for active HTML content
- Fast, lightweight
- Standard edition
- Professional edition
- Enterprise editions
3Extending HTML
HTML
4What Is ActiveX Scripting?
A language-independent standard that defines the
relationship between a scripting host and a
scripting engine
ActiveX Scripting
Internet Explorer (scripting host)
Visual Basic Script (scripting engine)
5A Simple Solution(Pioneered by Visual Basic)
- Objects raise events for the purpose of
coordinating their activity with the rest of the
world - Script code can be attached to an objects events
to customize behavior - this is scripting
Click Event
Button Object
Sub Button_Click MsgBox Hello world End Sub
6The Scripting Spectrum
- Dynamic run-time environments have varying
requirements -no one size fits all! - Small scripting languages cantarget specific
integration tasks
More coding,more like an application
Less coding,more like a document
Visual C
Visual Basic
Visual Basic Script
Internet Studio
Microsoft Office (Visual Basic for Applications)
7Visual Basic Scripting EditionA lightweight
scripting solution
- Small, fast, and safe
- Proper subset of Visual Basic for Applications
- 100 compatible with Visual Basic
- Built into Internet Explorer 3.0and Windows NT
- Cross-platform for easy mobility
- All clients, servers
- Licensable, not just for the Internet
- Free distribution
8VBScript Characteristics
- Native support for OLE
- Run time is a subset ofVisual Basic for
Applications - Small, fast parser and compiler suitable for code
distributed as source text - Small interpreter and run-time footprint are main
design goal
9Flexible Approach To Safety
- Core engine is safe, with a limited set of
intrinsic operations - Unsafe or platform-dependent features such as
file I/O and DLLs are moved into separate objects
(to which the host controls access) - Safety level can be adjusted in known secure
environments, such as private nets or servers
10VBScript And Visual Basic For Applications Synergy
- VBScript is a nucleus
- Working set size is critical
- Suitable for porting to any platform
- Freely licensable
- Visual Basic for Applications adds features and
UI - Premier RAD environment
- Run time adds more featuresand convenience
- OLE is fundamental to both
11VBScript And Visual Basic Contrasted
- Omitted features
- Data types
- User-defined types and classes
- Named arguments
- Error trapping and DoEvents
- Goto, gosub, and select case
- Debugging and conditional compilation
- File I/O, graphics, and DLL access
- More nitssee Web page fordetails
12Terms
Script A bunch of code, or a
persistent object representing a bunch of
code Scripting engine An OLE server that
provides a class of scripts. E.g.,
vbscript.dll Scripting host An application or
other component that uses scripting
engines Script site A host-provided object that
facilitates communication with a
particular script
13Browser Methods
- RefreshRefresh view
- GoBackNavigate to the previous item
- GoForwardNavigate to the next item
- GoHomeGo to home/start page
14Browser Methods
- GoSearchGo to search page
- Open(Target, Location, NoHistory)Opens a target
- StopStops opening a target
- PrintOut()Prints the document
15Browser MethodsFrame specific
- Navigate(Hlink, OpenInNewWin, NoHistory)
- BrowseBrowse for a new folder to view
- QuitExit frame and close the open window
16Browser Properties
- IDispatch Container A pointer to the container,
if any - IDispatch DocumentThe document
- BSTR TypeThe type of the document
- BOOL BusyBusy flag
- BOOL VisibleWhether the browser is visible or
hidden
17Browser PropertiesFrame specific
- BOOL FullScreen
- BOOL ToolBar
- BOOL StatusBar
- BSTR StatusText
- long Top LeftPosition of the frame window
relative to the screen (pixels) - long Height WidthSize of the frame window
(pixels)
18Browser Events
- Navigate(Hlink, Cancel)Fired when a new
hyperlink is being navigated to - StatusTextChange(Text)Statusbar text changed
- Error()Fired when an error occurs
- Quit(Cancel)Fired when application is quiting
19Questions
?