Link to home
Start Free TrialLog in
Avatar of Andrew Parker
Andrew ParkerFlag for Australia

asked on

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

Avatar of merowinger
merowinger
Flag of Germany image

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

SOLUTION
Avatar of mark1208
mark1208
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andrew Parker

ASKER

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 :)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ive got it mero, had to take the ,CLng(navOpenInNewTab) off the first IEobject :)
@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!
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?
do it as you like. Your question - Your decision!
I've no problem with point split, as mark delivered another solution