Re: Coonect to mail account using Tcl/Tk
- From: "Mark Janssen" <mpc.janssen@xxxxxxxxx>
- Date: 1 Dec 2006 05:35:29 -0800
rathin wrote:
No this is not what i mean, what i want is , I need a single script
[may be Tcl or linux script]
which does the following...
1) Opens an Browser the specified url...[ eg:gmail.com]
2) send the username and password [which should be sent as arguments fron
the script]
Regards,
Rathin
What I understand from your question is that you would like to automate
the login process by "driving" the browser.
Generally I don't think there is a good answer to this question because
of the large number of different browsers on Linux and the limited
possibility to interface with this running browser.
On windows it is possible using COM to drive for instance Internet
Explorer. The example below will only work for gmail.
----
package require tcom
# import types
::tcom::import shdocvw.dll
::tcom::import mshtml.tlb
set app [tcom::ref createobject InternetExplorer.Application]
set iapp [tcom::info interface $app]
# $iapp can be used for introspection
$app Visible 1
$app Navigate http://gmail.com
while {[$app Busy]} { after 500 }
set doc [$app Document]
set idoc [::tcom::info interface $doc]
set body [$doc body]
set ibody [::tcom::info interface $body]
set elements [$body all]
set login_fields {}
for {set i 0} {$i < [$elements length]} {incr i} {
set type [[$elements item $i] getAttribute type]
if {($type eq "text") || ($type eq "password") || ($type eq "submit")}
{
lappend login_fields [$elements item $i]
}
}
set user [lindex $argv 0]
set pass [lindex $argv 1]
[lindex $login_fields 0] innerText $user
[lindex $login_fields 1] innerText $pass
[lindex $login_fields end] click
exit
------
PS I am wondering what you try to gain by doing this. I can see two
scenario's
1) User types his login info on the command line in which case he might
just as well have typed it in the login screen.
2) User stores his credentials in a script which is a big security
nono. Offering this functionality will guarantee that some users will
do this.
Mark
.
- Follow-Ups:
- Re: Coonect to mail account using Tcl/Tk
- From: Cameron Laird
- Re: Coonect to mail account using Tcl/Tk
- References:
- Coonect to mail account using Tcl/Tk
- From: rathin
- Re: Coonect to mail account using Tcl/Tk
- From: rathin
- Coonect to mail account using Tcl/Tk
- Prev by Date: Re: Coonect to mail account using Tcl/Tk
- Next by Date: foreach & file
- Previous by thread: Re: Coonect to mail account using Tcl/Tk
- Next by thread: Re: Coonect to mail account using Tcl/Tk
- Index(es):
Relevant Pages
|
Loading