VBScript IE Window Update

Posted on 2009-05-12
Last Modified: 2012-05-06

Having some problem with updating IE windows with a VBScript! Basically I have 3 IE windows - window 1 launches window 2 and window 3, when window 3 is open window 2 closes. The problem I am having is then when the command to open the window is launched I can no longer reference the previous window to set values (see <HERE> below). Any ideas?

Do While (objExplorer.Document.Body.All.OKClicked.Value = "")

	Wscript.Sleep 250                 


	'If BCOP is launched...

	If objExplorer.Document.Body.All.OKClicked.Value = "BCOP" Then

		<HERE> objExplorer.Document.Body.All.OKClicked.Value = ""

		Set objExplorer2 = CreateObject("InternetExplorer.Application")

		objExplorer2.Navigate "about:blank"   

		objExplorer2.ToolBar = 0

		objExplorer2.StatusBar = 0

		objExplorer2.Left = (intHorizontal - 600) / 2

		objExplorer2.Top = (intVertical - 100) / 2

		objExplorer2.Width = 600

		objExplorer2.Height = 100 

		objExplorer2.Visible = 1     

		objExplorer2.Document.Body.Scroll = "no"

		objExplorer2.Document.Body.Style.Cursor = "wait"

		objExplorer2.Document.Title = "Opening the Barnardo's IT Code of Practice"

		objExplorer2.Document.Body.InnerHTML = "<face=Calibri><b> Please wait whilst the Barnardo's IT Code of Practice is opened </b>"

		BCOPOpen = "False"		

		'Launch Barnardo's IT Code of Practice

		Set objExplorer3 = WScript.CreateObject("InternetExplorer.Application", "IE_")

		objExplorer3.Navigate "file:" & strDestination

		objExplorer3.ToolBar = 0

		objExplorer3.StatusBar = 0

		objExplorer3.Visible = 1


		Do while (BCOPOpen = "False")

			Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") 

			Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process")

			For Each objProcess in colProcess

				If (objProcess.Name = "AcroRd32.exe") Then

					BCOPOpen = "True"


				End If



			Wscript.Sleep 500

			<HERE> objExplorer2.Document.Body.InnerHTML = objExplorer2.Document.Body.InnerHTML & "."




Open in new window

Question by:Barnardos_2LS

Accepted Solution

Hubasan earned 500 total points
Comment Utility
Solution should be very easy. Just create variables before the entire DO - LOOP construct and assign them EMPTY values, then during the window opening sequence assign values to those variables that can then be called upon at any time in the script. Something like below:

sVariable1 = Empty
sVariable2 = Empty

Do While (objExplorer.Document.Body.All.OKClicked.Value = "")
      If something happened here Then
            sVariable2 = "SomeValue"
      End If

Hope that helps you.

Author Closing Comment

Comment Utility

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at (http://www.experts-ex…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now