?
Solved

VBS Progress bar (IE)

Posted on 2011-02-14
3
Medium Priority
?
1,184 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 2000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Introduction to Processes
Suggested Courses

741 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