Solved

VBScript IE Window Update

Posted on 2009-05-12
2
361 Views
Last Modified: 2012-05-06
Hi,

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?

Michael
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"
				Else
				End If
			Next
	
			Wscript.Sleep 500
			<HERE> objExplorer2.Document.Body.InnerHTML = objExplorer2.Document.Body.InnerHTML & "."
		Loop
 
		objExplorer2.Quit     
Loop

Open in new window

0
Comment
Question by:Barnardos_2LS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
Hubasan earned 500 total points
ID: 24364914
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
      ...
      ...
Loop


Hope that helps you.
0
 
LVL 1

Author Closing Comment

by:Barnardos_2LS
ID: 31580501
Thanks.
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to count occurrences of each item in an array.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

749 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