Solved

VBS Progress bar (IE)

Posted on 2011-02-14
3
1,177 Views
Last Modified: 2012-05-11
Heya,

During a vbs login script I would like to output updates to the user. This is what I currently have:

Set objExplorer = WScript.CreateObject("InternetExplorer.Application","IE_")
objExplorer.Navigate "about:blank"   
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=400
objExplorer.Height = 300 
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1

StatusUpdate("Starting")
'#####Execute some commands#####
StatusUpdate("Halfway")
'#####Execute some commands#####
StatusUpdate("Finished")

Sub StatusUpdate(Input)
	objExplorer.Document.Body.InnerHTML = objExplorer.Document.Body.InnerHTML & input
End Sub

objExplorer.Quit

Open in new window


(I have removed the commands as they are irrelevant & this keeps the troubleshooting simple)
This code creates a little IE window & updates the contents with the strings I feed the sub.

My probems/questions are

1) When this runs for the first time on a users machine it also pops up with the "IE is not your default browser" message (if the user has not run IE before & disabled that popup). Is there a way around that, perhaps by getting the script to disable that popup (registry value?) before running the IE window?

2) Is using an IE window the best way to achieve what I`m trying to do, i.e. output messages to keep the user updated on the progress of the script. Using the echo vbs command doesn`t help because I don`t want the script to be interrupted waiting for the user to click the OK button.

Thanks in advance,
0
Comment
Question by:Roger Adams
[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
3 Comments
 

Accepted Solution

by:
Roger Adams earned 0 total points
ID: 34889934
Update.

May have found the solution to question 1:
'Change the registry value to disable the IE Default Browser popup
Dim SysVarReg, Value
Value = "no"
Set SysVarReg = WScript.CreateObject("WScript.Shell")
SysVarReg.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Check_Associations", Value

Open in new window


will test in the morning & update...
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 500 total points
ID: 34892485
Hi, it looks like that would work for question 1, as long as you put that at the start of your code.

For question 2, yes, it is one of the best ways, although I haven't tested that sort of solution since IE7 and IE8, and Windows 7 came out, so I'm not sure whether it works reliably on those platforms.  I know that some IE automation in IE8 can bomb out because of the added security in it, so watch out for that.

You *could* run the script with cscript, and use WScript.Echo statements to output the message to the command prompt.  This doesn't require pressing OK when run with cscript instead of wscript.

The last option is probably to have the logon script launch a HTA by using
Set objShell = CreateObject("WScript.Shell")
objShell.Run "msthta.exe ""\\server\share\Logon.hta""", 1, True

and then have the code in the HTA update progress to the html elements in it.

Regards,

Rob.
0
 

Author Closing Comment

by:Roger Adams
ID: 34936310
Didn`t like the idea of calling another script, or HTA, and with the reg edit the IE solution was best.

Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…

739 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