Solved

VBS Progress bar (IE)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

15 Experts available now in Live!

Get 1:1 Help Now