Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keystrokes to internet explorer 1

Status
Not open for further replies.

lsan

Programmer
May 1, 2003
3
US
I am trying to write a script to open internet explorer and navigate to a certain webpage. When the user gets to this webpage a pop up window comes up with a disclaimer. You must click O.K. to bypass this disclaimer and get you into the site. I want to automate this process so the user doesn't have to click O.K. every time.

Here's my script:
Code:
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Visible = 1
objIE.Navigate &quot;<website>&quot;
WScript.Sleep 1000
objIE.SendKeys &quot;{ENTER}&quot;
When I run the script I get to the website but I get the error: &quot;Object doesn't support this property or method objIE.SendKeys&quot;

Any ideas of what I can do differently?
 
Replace

objIE.SendKeys &quot;{ENTER}&quot;

with

Set oShell = CreateObject(&quot;Wscript.Shell&quot;)
oShell.AppActivate objIE.LocationName
oShell.SendKeys &quot;{ENTER}&quot;

Also, fwiw, depending on your page, you may want to replace

WScript.Sleep 1000

with a procedure to actually check the page loading status, such as

Do While objIE.Busy Or objIE.ReadyState <> 4
WScript.Sleep 500
Loop

Jon Hawkins
 
It still is not working. It just sits there at the pop-up disclaimer window forever. Any other ideas?
 
can you use enter key manually and see if it does bypass this site?
 
Yes. The enter key works fine manually. Any help would be appreciated. Thanks!
 
Can you post the URL to the webpage? It would be helpful if we could see the &quot;popup window&quot; and exactly what you are clicking.

Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top