Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBS Progress bar (IE)

Posted on 2011-02-14
3
Medium Priority
?
1,190 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
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 …
Simple Linear Regression

618 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