I am really new in scripting and I was curious if it is possible to run
Internet Explorer, go to a specific URL, automatically send username
and password in the appropriate fields to log in.

Re: Automatically Logging Into Websites by Ayush

Ayush
Wed Jan 24 17:38:33 CST 2007

Replied to [jay068@gmail.com]s message :
> I am really new in scripting and I was curious if it is possible to run
> Internet Explorer, go to a specific URL, automatically send username
> and password in the appropriate fields to log in.
>

1.Use InternetExplorer.Application object's Navigate method to load a page
2.get document object of page
3.Set the values of input and password boxes.

like this (for google):

Set iExA = CreateObject("InternetExplorer.Application")
iExA.Navigate("http://google.com")
iExA.Visible=True
Do While iExA.Busy=True
WScript.Sleep 10
Loop
Set docuObj = iExA.Document
docuObj.getElementsByName("q")(0).value="Search Query"



--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Praetorian

Praetorian
Fri Feb 02 13:06:51 CST 2007

On Jan 24, 3:38=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [jay...@gmail.com]s message :
>
> > I am really new in scripting and I was curious if it is possible to run
> > Internet Explorer, go to a specific URL, automatically send username
> > and password in the appropriate fields to log in.
>
> 1.Use InternetExplorer.Application object's Navigate method to load a page
> 2.get document object of page
> 3.Set the values of input and password boxes.
>
> like this (for google):
>
> Set iExA =3D CreateObject("InternetExplorer.Application")
> iExA.Navigate("http://google.com")
> iExA.Visible=3DTrue
> Do While iExA.Busy=3DTrue
> WScript.Sleep 10
> Loop
> Set docuObj =3D iExA.Document
> docuObj.getElementsByName("q")(0).value=3D"Search Query"
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

Thank you, it worked perfectly. Is it possible to select the "submit"
button in the script, bypassing using the mouse?


Re: Automatically Logging Into Websites by Ayush

Ayush
Fri Feb 02 13:25:29 CST 2007

Replied to [Praetorian Prefect]s message :
> Thank you, it worked perfectly. Is it possible to select the "submit"
> button in the script, bypassing using the mouse?
>


Yes. Get the button element like this then run the click method :

like this :
docuObj.getElementsByName("xxx")(x).click

where xxx is the name of elements and x is the index.

like this (for google again ):
Set iExA = CreateObject("InternetExplorer.Application")
iExA.Navigate("http://google.com")
iExA.Visible=True
Do While iExA.Busy=True
WScript.Sleep 10
Loop
Set docuObj = iExA.Document
docuObj.getElementsByName("q")(0).value="Search Query"
docuObj.getElementsByName("btnG")(0).click



--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Praetorian

Praetorian
Fri Feb 02 14:30:21 CST 2007

On Feb 2, 11:25=C2=A0am, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [Praetorian Prefect]s message :
>
> > Thank you, it worked perfectly. =C2=A0Is it possible to select the "sub=
mit"
> > button in the script, bypassing using the mouse?
>
> Yes. Get the button element like this then run the click method :
>
> like this :
> docuObj.getElementsByName("xxx")(x).click
>
> where xxx is the name of elements and x is the index.
>
> like this (for google again ):
> Set iExA =3D CreateObject("InternetExplorer.Application")
> iExA.Navigate("http://google.com")
> =C2=A0 iExA.Visible=3DTrue
> Do While iExA.Busy=3DTrue
> WScript.Sleep 10
> Loop
> Set docuObj =3D iExA.Document
> docuObj.getElementsByName("q")(0).value=3D"Search Query"
> docuObj.getElementsByName("btnG")(0).click
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

Ayush,

<td rowspan=3D'2'><input tabindex=3D'3' type=3D'submit' value=3D'&nbsp; &nb=
sp;
Login &nbsp; &nbsp;' style=3D'background-color: #69A1BC; border: solid
#FFF 1px; outset: 0px; color: #FFF; font-weight: bold;'/></td>

above is the "Login" button (but no button).




Re: Automatically Logging Into Websites by Ayush

Ayush
Fri Feb 02 15:50:04 CST 2007

Replied to [Praetorian Prefect]s message :
> Ayush,
>
> <td rowspan='2'><input tabindex='3' type='submit' value='&nbsp; &nbsp;
> Login &nbsp; &nbsp;' style='background-color: #69A1BC; border: solid
> #FFF 1px; outset: 0px; color: #FFF; font-weight: bold;'/></td>
>
> above is the "Login" button (but no button).


Get the parent element(or parent element of parent element..) then use
getElementByTagNames method on that element :

if the html is like this :

<tr id="xx"> <--- this tr has ID
<td rowspan='2'><input tabindex='3' type='submit' value='&nbsp; &nbsp;
Login &nbsp; &nbsp;' style='background-color: #69A1BC; border: solid
#FFF 1px; outset: 0px; color: #FFF; font-weight: bold;'/></td>
<td ..etc.etc..
</tr>


'get the input elements under that parentElement :
set inputElms = document.getElementById("xx").getElementsByTagName("input")

For Each inputElm in inputElms
If LCase(inputElm.Type)="submit" AND InStr(LCase(inputElm.value),"Login") Then
inputElm.Click : Exit For
End If
Next


if you have problems making this then post the URl of web page ..

--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Praetorian

Praetorian
Fri Feb 02 16:10:58 CST 2007

On Feb 2, 1:50=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [Praetorian Prefect]s message :
>
> > Ayush,
>
> > <td rowspan=3D'2'><input tabindex=3D'3' type=3D'submit' value=3D'&nbsp;=
&nbsp;
> > Login &nbsp; &nbsp;' style=3D'background-color: #69A1BC; border: solid
> > #FFF 1px; outset: 0px; color: #FFF; font-weight: bold;'/></td>
>
> > above is the "Login" button (but no button).
>
> Get the parent element(or parent element of parent element..) then use
> getElementByTagNames method on that element :
>
> if the html is like this :
>
> <tr id=3D"xx"> =C2=A0 =C2=A0<--- this tr has ID
> <td rowspan=3D'2'><input tabindex=3D'3' type=3D'submit' value=3D'&nbsp; &=
nbsp;
> Login &nbsp; &nbsp;' style=3D'background-color: #69A1BC; border: solid
> #FFF 1px; outset: 0px; color: #FFF; font-weight: bold;'/></td>
> <td ..etc.etc..
> </tr>
>
> 'get the input elements under that parentElement :
> set inputElms =3D document.getElementById("xx").getElementsByTagName("inp=
ut")
>
> For Each inputElm in inputElms
> If LCase(inputElm.Type)=3D"submit" AND InStr(LCase(inputElm.value),"Login=
") Then
> inputElm.Click : Exit For
> End If
> Next
>
> if you have problems making this then post the URl of web page ..
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

https://nmciwarroom.idc-mcs.com/


Re: Automatically Logging Into Websites by Ayush

Ayush
Fri Feb 02 17:08:14 CST 2007

Replied to [Praetorian Prefect]s message :
>
> https://nmciwarroom.idc-mcs.com/
>

This line should work for submit button:
docuObj.getElementsByTagName("INPUT")(1).click

so the full script :

Set iExA = CreateObject("InternetExplorer.Application")
iExA.Navigate("https://nmciwarroom.idc-mcs.com/")
iExA.Visible=True
Do While iExA.Busy=True
WScript.Sleep 10
Loop
Set docuObj = iExA.Document
docuObj.getElementsByName("login_name")(0).value="UserName"
docuObj.getElementsByName("login_pass")(0).value="Password"
docuObj.getElementsByTagName("INPUT")(1).click



--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Praetorian

Praetorian
Fri Feb 02 21:41:32 CST 2007

On Feb 2, 3:08=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [Praetorian Prefect]s message :
>
>
>
> >https://nmciwarroom.idc-mcs.com/
>
> This line should work for submit button:
> docuObj.getElementsByTagName("INPUT")(1).click
>
> so the full script :
>
> Set iExA =3D CreateObject("InternetExplorer.Application")
> iExA.Navigate("https://nmciwarroom.idc-mcs.com/")
> =C2=A0 iExA.Visible=3DTrue
> Do While iExA.Busy=3DTrue
> WScript.Sleep 10
> Loop
> Set docuObj =3D iExA.Document
> docuObj.getElementsByName("login_name")(0).value=3D"UserName"
> docuObj.getElementsByName("login_pass")(0).value=3D"Password"
> docuObj.getElementsByTagName("INPUT")(1).click
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

Appreciate it. That worked. Where in the HTML can you find that
"INPUT"?


Re: Automatically Logging Into Websites by Praetorian

Praetorian
Fri Feb 02 23:28:36 CST 2007

On Feb 2, 3:08=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [Praetorian Prefect]s message :
>
>
>
> >https://nmciwarroom.idc-mcs.com/
>
> This line should work for submit button:
> docuObj.getElementsByTagName("INPUT")(1).click
>
> so the full script :
>
> Set iExA =3D CreateObject("InternetExplorer.Application")
> iExA.Navigate("https://nmciwarroom.idc-mcs.com/")
> =C2=A0 iExA.Visible=3DTrue
> Do While iExA.Busy=3DTrue
> WScript.Sleep 10
> Loop
> Set docuObj =3D iExA.Document
> docuObj.getElementsByName("login_name")(0).value=3D"UserName"
> docuObj.getElementsByName("login_pass")(0).value=3D"Password"
> docuObj.getElementsByTagName("INPUT")(1).click
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

Are there available resources online that shows what can be
manipulated in the HTML by vbscript, like the
docuObj.getElementsByTagname, how to select links using vbscript...etc.


Re: Automatically Logging Into Websites by Ayush

Ayush
Sat Feb 03 00:19:54 CST 2007

Replied to [Praetorian Prefect]s message :
> > docuObj.getElementsByTagName("INPUT")(1).click


> Appreciate it. That worked.
>

You are welcome..


> Where in the HTML can you find that
> "INPUT"?

This time it is not searhing for INput in element name, it is searching for the INPUT
tag names :
<*INPUT* etc.>
<*INPUT* etc. >

docuObj.getElementsByTagName("INPUT") returns all the elements with INPUT tag names >>
"(1)" means the 2nd element >>
click method clcks the 2nd input element .


--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Ayush

Ayush
Sat Feb 03 00:23:24 CST 2007

Replied to [Praetorian Prefect]s message :

> Are there available resources online that shows what can be
> manipulated in the HTML by vbscript, like the
> docuObj.getElementsByTagname, how to select links using vbscript...etc.
>

You can change almost anything by using IE.App(internetexplorer.application) object
then getting the document object.

Here is the reference that can be done :
http://snipurl.com/DHTML_Reference


--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: Automatically Logging Into Websites by Praetorian

Praetorian
Sun Feb 04 22:04:15 CST 2007

On Feb 2, 10:23=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [Praetorian Prefect]s message :
>
> > Are there available resources online that shows what can be
> > manipulated in the HTML by vbscript, like the
> > docuObj.getElementsByTagname, how to select links using vbscript...etc.
>
> You can change almost anything by using IE.App(internetexplorer.applicati=
on) object
> then getting the document object.
>
> Here is the reference that can be done :http://snipurl.com/DHTML_Reference
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------

I tried using *input* but it's not working for this website,
http://webmail.netzero.net


Re: Automatically Logging Into Websites by Ayush

Ayush
Sun Feb 04 22:25:52 CST 2007

Replied to [Praetorian Prefect]s message :
> On Feb 2, 10:23 pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
>> Replied to [Praetorian Prefect]s message :
>>
>>> Are there available resources online that shows what can be
>>> manipulated in the HTML by vbscript, like the
>>> docuObj.getElementsByTagname, how to select links using vbscript...etc.
>> You can change almost anything by using IE.App(internetexplorer.application) object
>> then getting the document object.
>>
>> Here is the reference that can be done :http://snipurl.com/DHTML_Reference
>>
>> --
>> â?? Ayush
>> -------------
>> Search -www.Google.com| Wikipedia -http://en.wikipedia.org
>> Snip your long urls -http://snipurl.com/
>> -------------
>
> I tried using *input* but it's not working for this website,
> http://webmail.netzero.net
>


It should work if you use the correct index number of input. But In this case, use name :

docuObj.getElementsByName("NAME")(0).value="UserName"
docuObj.getElementsByName("PASSWORD")(0).value="Password"
docuObj.getElementsByName("LOGIN")(0).click

Or


docuObj.getElementsByName("NAME")(0).value="UserName"
docuObj.getElementsByName("PASSWORD")(0).value="Password"
docuObj.forms("newNameForm")(0).submit()
--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------