The script then maps or disconnects the drive, depending on
what??™s needed; it??™s a quick and easy toggle that Windows itself just doesn??™t
provide.
How to Control Internet Explorer
Because VBScript owes its existence, in part, to Internet Explorer (IE), it
seems only fair that there would be some integration between WSH and IE.
The key is the IE object and the properties and methods associated with it.
Note that the code in this section is not presented as a subroutine, mostly
because all of the subsequent statements that reference the IEObject object
(such as IEObject.Document.Write) would fail if the initial Set statement was
isolated in its own routine.
Begin with the following lines in your script, which start the IE application,
initialize an object to reference, and open a blank IE window:
Set IEObject = CreateObject("InternetExplorer.Application")
If Err.number <> 0 Then
MsgBox "There was a problem starting Internet Explorer."
wScript.Quit
End If
IEObject.Left = 75
IEObject.Top = 75
IEObject.Width = 400
IEObject.Height = 300
IEObject.Menubar = 0
IEObject.Toolbar = 0
IEObject.Navigate "About:Blank"
IEObject.Visible=1
Do while IEObject.Busy
Rem -- wait for window to open --
Loop
534 | Chapter 9: Scripting and Automation
Note the error checking at the beginning, which quits if there??™s a problem
loading IE. The subsequent commands customize the window to our needs;
the Left, Top, Width, and Height properties are all in pixels; for the MenuBar
and Toolbar properties, 0 means hidden and 1 means visible.
Pages:
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742