Re: Coonect to mail account using Tcl/Tk




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

.



Relevant Pages

  • Re: Access 2010 with Sharepoint 2010
    ... the browser as in Access itself? ... I've said elsewhere that I'm wary of embedded macros because of the ... An existing app ... that when I deploy to the client system, ...
    (comp.databases.ms-access)
  • SQL & VB Dates/Times!!!
    ... I've written an asp app that requires users to login - normal stuff. ... browser. ... Script looks like this (essentially StrOnlineTimedOut is 5 minutes from ...
    (microsoft.public.vstudio.general)
  • Re: Tkinter or wxpython?
    ... If you can get them to install a desktop app ... The permission mechanism is admittedly browser dependent. ... not so much for an application platform. ... HTML has non-trivial cross browser differences. ...
    (comp.lang.python)
  • Re: Tkinter or wxpython?
    ... If you can get them to install a desktop app ... The permission mechanism is admittedly browser dependent. ... not so much for an application platform. ... HTML has non-trivial cross browser differences. ...
    (comp.lang.python)
  • Re: Tkinter or wxpython?
    ... If you can get them to install a desktop app ... The permission mechanism is admittedly browser dependent. ... But if you write your application with straightforward html ... you tend to have very few platform problems. ...
    (comp.lang.python)

Loading