vbs error with IE startup script on new laptop

Hi all

A few experts helped me a while back to create the code below to open a number of IE sites when my pc starts up.  I have just moved to a new laptop but on startup with the same files it comes up with a VB error

script:   C:\documents and settings\parker_a\desktop\Startup Files\ IE Startup1.vbs        
Line 17
Char 27
Error Expected end of statement
Code 800A0401
Source Microsoft VBScript compilation error.

This worked fine on my old PC no real change in spec, any ideas?

Const navOpenInBackgroundTab = &H1000&
 
strSite1 = "http://bdi/Admin/ChangeManagement/Default.asp?Order=RefID&Status=All"
strSite2 = "http://bdi3/sites/ict/projects/Lists/Project%20Reporting/Project%20Reporting.aspx"
strSite3 = "http://bdi3/Library/Pages/Systems%20Event%20Planner.aspx"
strSite4 = "http://www.google.co.uk/"
strSite5 = "http://www.experts-exchange.com/"
strSite6 = "http://www.bbc.com"
strSite7 = "http://bdi3/Pages/Default.aspx"
strSite8 = "http://prd-infra/infralive/infraEnterprise8.htm"
strSite9 = "http://prd-ap201-vm/acweb/login.aspx"
 
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Location = New Point(100, 100)
objIE.Navigate2 strSite1
objIE.Navigate2 strSite2, navOpenInBackgroundTab
objIE.Navigate2 strSite3, navOpenInBackgroundTab
objIE.Navigate2 strSite9, navOpenInBackgroundTab
objIE.Navigate2 strSite8, navOpenInBackgroundTab
objIE.Navigate2 strSite10, navOpenInBackgroundTab
objIE.Visible = True
 
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Navigate2 strSite7
objIE.Navigate2 strSite4, navOpenInBackgroundTab
objIE.Navigate2 strSite5, navOpenInBackgroundTab
objIE.Visible = True

Open in new window

Andrew ParkerIT Field Systems Delivery OfficerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

merowingerCommented:
the below worked for me.
The above listed code seems to be written for visual basic (vb) and not vbs.
Also there are problems with the spaces in the URL (%20), which are causing strange errors. Please no not use the %20 in the script
const navOpenInNewTab = &h0800

Set objIE = CreateObject("InternetExplorer.Application")

objIE.Navigate "http://www.experts-exchange.com",CLng(navOpenInNewTab)
objIE.Navigate "http://www.google.co.uk",CLng(navOpenInNewTab)
objIE.Navigate "http://www.bbc.com",CLng(navOpenInNewTab)
objIE.Navigate "http://bdi3/Library/Pages/Systems Event Planner.aspx",CLng(navOpenInNewTab)
objIE.Navigate "http://bdi3/Pages/Default.aspx",CLng(navOpenInNewTab)
objIE.Visible = True
Set objIE = Nothing

Set objIE = CreateObject("InternetExplorer.Application")

objIE.Navigate "http://bdi/Admin/ChangeManagement/Default.asp?Order=RefID&Status=All",CLng(navOpenInNewTab)
objIE.Navigate "http://bdi3/sites/ict/projects/Lists/Project Reporting/Project Reporting.aspx",CLng(navOpenInNewTab)
objIE.Navigate "http://bdi3/Library/Pages/Systems Event Planner.aspx",CLng(navOpenInNewTab)
objIE.Visible = True

Open in new window

0
mark1208Commented:
There appear to have been some significant changes with the object.Navigate and object.Navigate2 Methods between IE6, IE7, and IE8 (specifically with Protected Mode in IE8 and Security Zones in IE7 and above), so I bet you have inadvertently changed versions during the transition to your new PC. Like merowinger above, I was able to tweak your code a bit (into JavaScript here) to produce the intended results. See attached.

Hope this helps!
Mark

' Adapted in part from http://blogs.msdn.com/tonyschr/

var strSite1 = "http://bdi/Admin/ChangeManagement/Default.asp?Order=RefID&Status=All"
var strSite2 = "http://bdi3/sites/ict/projects/Lists/Project%20Reporting/Project%20Reporting.aspx"
var strSite3 = "http://bdi3/Library/Pages/Systems%20Event%20Planner.aspx"
var strSite4 = "http://www.google.co.uk/"
var strSite5 = "http://www.experts-exchange.com/"
var strSite6 = "http://www.bbc.com"
var strSite7 = "http://bdi3/Pages/Default.aspx"
var strSite8 = "http://prd-infra/infralive/infraEnterprise8.htm"
var strSite9 = "http://prd-ap201-vm/acweb/login.aspx"
 
var navOpenInBackgroundTab = 0x1000;
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.Navigate2(strSite1);
oIE.Navigate2(strSite2, navOpenInBackgroundTab);
oIE.Navigate2(strSite3, navOpenInBackgroundTab);
oIE.Navigate2(strSite9, navOpenInBackgroundTab);
oIE.Navigate2(strSite8, navOpenInBackgroundTab);
oIE.Visible = true;

var navOpenInBackgroundTab = 0x1000;
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.Navigate2(strSite7);
oIE.Navigate2(strSite4, navOpenInBackgroundTab);
oIE.Navigate2(strSite5, navOpenInBackgroundTab);
oIE.Visible = true;

Open in new window

0
Andrew ParkerIT Field Systems Delivery OfficerAuthor Commented:
Stupid question mark, but how would I run the javascript as at the moment ive got a vbs file.

@mero, that works cool, but it seems to add an extra tab at the start that doesnt connect to anything?  strange :)
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

merowingerCommented:
Yes i had to add them, else i got that strange errors.
Here's a version without the first empty tab, maybe it runs for you without errors
const navOpenInNewTab = &h0800 
 
Set objIE = CreateObject("InternetExplorer.Application") 
 
objIE.Navigate "http://www.experts-exchange.com"
objIE.Navigate "http://www.google.co.uk",CLng(navOpenInNewTab) 
objIE.Navigate "http://www.bbc.com",CLng(navOpenInNewTab) 
objIE.Navigate "http://bdi3/Library/Pages/Systems Event Planner.aspx",CLng(navOpenInNewTab) 
objIE.Navigate "http://bdi3/Pages/Default.aspx",CLng(navOpenInNewTab) 
objIE.Visible = True 
Set objIE = Nothing 
 
Set objIE = CreateObject("InternetExplorer.Application") 
 
objIE.Navigate "http://bdi/Admin/ChangeManagement/Default.asp?Order=RefID&Status=All"
objIE.Navigate "http://bdi3/sites/ict/projects/Lists/Project Reporting/Project Reporting.aspx",CLng(navOpenInNewTab) 
objIE.Navigate "http://bdi3/Library/Pages/Systems Event Planner.aspx",CLng(navOpenInNewTab) 
objIE.Visible = True

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andrew ParkerIT Field Systems Delivery OfficerAuthor Commented:
ive got it mero, had to take the ,CLng(navOpenInNewTab) off the first IEobject :)
0
mark1208Commented:
@Andrewajp002 ... not a stupid question at all!

Just paste the JavaScript code into a standard text file, just as with VBS. Only rename the extension to .js instead of .vbs. Use cscript, wscript, or an old-fashioned double-click from within the GUI to have Windows Scripting Host compile and launch. Voila!
0
Andrew ParkerIT Field Systems Delivery OfficerAuthor Commented:
Hi Mark, not sure why but its coming up with a few errors, Meros one works perfectly, if its ok with mero I will split the points 80/20?
0
merowingerCommented:
do it as you like. Your question - Your decision!
I've no problem with point split, as mark delivered another solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.