VBscript to enter username and password

June 27, 2009 at 11:36:31
Specs: Windows XP

Hi all!

If someone would be so kind and help me find a command to enter a username and password in a web page?

For example if i have a batch:
@echo off
start http://www.google.com/mail

And if you notice it will have a username and password prompt.

Is there a command that will enter your username and password in those boxes?

Any help will be appreciated!

Thanks ,
Madhavi


See More: VBscript to enter username and password

Report •


#1
June 27, 2009 at 12:52:36

There are macro programs out there that might be able to do this, but using strictly vbscript or a batch file running on the local computer is not going to work.

-Ryan Adams
Free Computer Tips and more:http://RyanTAdams.com

Paid Tech Support: Black Diamond


Report •

#2
June 27, 2009 at 13:36:49

RTAdams89: using strictly vbscript or a batch file running on the local computer is not going to work.
This is incorrect. Internet Explorer exposes the DOM though its ActiveX control, which can be used by VBScript to interact with the website.

Report •

#3
June 28, 2009 at 01:35:46

Can you provide an alternate for same ?

Report •

Related Solutions

#4
June 28, 2009 at 08:20:28

As I said, Internet Explorer exposes the page's DOM. This means you can make an auto log on script, but it must be customized for each page. For Google Mail, your script would go something like this:
WScript.Quit Main

Function Main
  Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
  IE.Visible = True
  IE.Navigate "http://www.google.com/mail"
  Wait IE
  With IE.Document
    .getElementByID("Email").value = "you@gmail.com"
    .getElementByID("Passwd").value = "Your Password"
    .getElementByID("gaia_loginform").submit
  End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
End Sub

Sub IE_OnQuit
  On Error Resume Next
  WScript.StdErr.WriteLine "IE closed before script finished."
  WScript.Quit
End Sub


Report •

#5
June 28, 2009 at 17:35:28

Wow. I've never seen that work before. Good job Razor.

-Ryan Adams
Free Computer Tips and more:http://RyanTAdams.com

Paid Tech Support: Black Diamond


Report •


Ask Question