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?
 
merowingerConnect With a Mentor Commented:
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
 
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
 
mark1208Connect With a Mentor Commented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.