Link to home
Start Free TrialLog in
Avatar of PCDJ
PCDJ

asked on

Creating Batch File

Using: Win2000 IE6.  Want to create a batch file that open IE and then CTRL + O - anyone can help? Thanks.
Avatar of Paul Maker
Paul Maker
Flag of United Kingdom of Great Britain and Northern Ireland image

use Windows scripting host. create a file with a .vbs extension and copy this code into it.

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
WshShell.SendKeys("^o")
Avatar of bonzai
bonzai

Hi

I had the same idea, but I don't like the
"sendkeys" (depends to much on System's speed. What happens if your window is not active?)

what do you want to do exactly? Open Files or navigate to URL's?

assuming you want your user to input an URL and then browse-to:¨

'-------------sample script-------------
Set oIE = CreateObject("internetexplorer.application")

pageToGo = inputbox("Enter URL","vbscript sample")

oIe.visible = true
oIe.navigate pageToGo
'---------------------------------------

greets
bonzai
Avatar of PCDJ

ASKER

I created a new text doc, pasted makerp's code, changed to .vbs - did not work.  Used Bonzai's code - sweet !  Thank You Both!
-Ron
Avatar of PCDJ

ASKER

OK, that code Bonzai supplied, who can add to it?

If I run that, I'm prompted for a URL.  If I click the X or Cancel, the web browser opens and says Cannot Find Server.

What can I add to the code so that doesn't happen, or browser closes, or goes to a default URL specified in the code.  Prefer the browser just closed though.

Thank You
ASKER CERTIFIED SOLUTION
Avatar of bonzai
bonzai

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 PCDJ

ASKER

SWEET!!!!

Thank U- a thousand times!

I removed the www.google.com and it worked just as fine.
Nice how the pre-determined url is 'selected', ready for typing!

-Ron
This question is still open and getting old. If any of the comment(s) above helped you please accept it as an answer or split the points who ever helped you in this question. Your attention in finalising this question is very much appreciated. Thanks in advance,

****** PLEASE DO NOT ACCEPT THIS AS AN ANSWER ********

- If you would like to close this question and have your points refunded, please post a question in community support area on https://www.experts-exchange.com/Community_Support/ giving the address of this question. Thank you      

Pasha

Cleanup Volunteer