Solved

VBS Progress bar (IE)

Posted on 2011-02-14
3
1,161 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 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

21 Experts available now in Live!

Get 1:1 Help Now