We help IT Professionals succeed at work.
Get Started

VBScript to delay until full page load

leokuz
leokuz asked
on
5,945 Views
Last Modified: 2013-12-25
I am wondering if there is a way to modify this auto login code so that it would run immediately after the entire html page has been loaded.

I don't like this code as it is now because if page loads to fast, then I end up waiting 4.5 seconds looking at the login prompt, but if I specify less time, then when page loads too slow, the code runs long before page fully loaded and we get to nowhere. By default the cursor on subject page sits in username's field. I have no control over the subject html page. Please help if you can.

Here is the code:

'-----------------------------------------------------'
Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "http://www.somewebsite.com"
Wscript.Sleep 4500
objShell.SendKeys "username"
objShell.SendKeys "{TAB}"
Wscript.Sleep 100
objShell.SendKeys "password"
objShell.SendKeys "{ENTER}"
WScript.Quit
'-----------------------------------------------------'
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2007
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE