Problems handling a login form

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Problems handling a login form

Post by EnderFFX » Wed Jun 14, 2006 5:26 pm

Very simple what I want done:
1) Open IE
2) Open a specific web page
3) put in an account and a password at a protected site (like a form comes up outside of the html page and asks for a password and account)
4) click ok

User account tab is hot keyed by pressing Alt-U which is how i was trying to navigate to it. Any help would be appreciated.

Web page loads up fine, i can't seem to put in the account or password.

VBStart
Dim IE

Sub CreateIE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=1
End Sub

Sub Navigate(URL)
IE.Navigate URL
do while IE.Busy
Loop
End Sub

Sub KillIE
IE.Quit
Set IE = Nothing
End Sub

VBEnd

let>password=password
let>account=account

SRT>LoginTest
Press Alt
wait>0.1
Send>u
wait>0.1
Release Alt
Wait>0.1
Send>%account%
Press Tab
Wait>0.1
Send>%password%
Press Tab
Press Tab
LClick
End>LoginTest

VBRun>CreateIE
VBRun>Navigate,http://www.testsite.com
GoSub>LoginTest

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jun 14, 2006 5:32 pm

As you are sending the username and password via keystrokes you will need a SetFocus line first to ensure the new IE window has the keyboard focus. You also need to make sure the username and password boxes are focused. To do that you can Press Tab to move focus from field to field. Work out how many Tab key presses are required to get to the username box and then add Press Tab * n where n is the number of tabs:

SetFocus>Title of Pop Up
Press ALT
Send>u
Release ALT
Press Tab * 4
Send>Username
etc

Modify the Press Tab line accordingly.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Figured it out

Post by EnderFFX » Wed Jun 14, 2006 5:55 pm

When regaining focus wasn't working, I figured out that IE had never completed loading the web page and was waiting for the account/password to continue loading, so this is what i did.

Sub Navigate(URL)
IE.Navigate URL
End Sub

I didn't wait for the page to continue loading, I just waited for around 3-5 seconds to make sure the login/password box loaded up.

Thx for the help mtettmar, you got me thinking along the right lines to figure out the problem.

Oh and the last LClick should be Press Enter since I was tabbing over to the OK button.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts