Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

Creating Batch File

Using: Win2000 IE6.  Want to create a batch file that open IE and then CTRL + O - anyone can help? Thanks.
0
PCDJ
Asked:
PCDJ
1 Solution
 
makerpCommented:
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")
0
 
bonzaiCommented:
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
0
 
PCDJAuthor Commented:
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
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
PCDJAuthor Commented:
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
0
 
bonzaiCommented:
Hi

try this...

'---------------------------------------
main
sub main()
     Set oIE = CreateObject("internetexplorer.application")
     pageToGo = inputbox("Enter URL","vbscript sample","www.google.com")
     select case pagetogo
          case ""
               exit sub
          case Else
               oIe.visible = true
               oIe.navigate pageToGo
     end select
end sub

'---------------------------------------
0
 
PCDJAuthor Commented:
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
0
 
cempashaCommented:
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 http://www.experts-exchange.com/Community_Support/ giving the address of this question. Thank you      

Pasha

Cleanup Volunteer


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now