Sign in to follow this  
Followers 0
YpR^

Making a "login - GUI" ?

25 posts in this topic

#1 ·  Posted (edited)

I've searched the forum and found the "login to hotmail script".

Looks like this:

#include <IE.au3>
 
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")
 
; Get pointers to the login form and username, password, and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
 
$username = "your username here"
$password = "your password here"
 
; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
 
Exit

Instead of the "static" username and password - is it possible to make a login-screen to manually type in user / pass ? And what about a "remember me" thingy?

I've made this:

$value = InputBox("Username", "1", "", " M99")
$value1 = InputBox("Password", "2", "", " M99")

But instead of the 2 boxes i would like one single :whistle: and what to insert in script if i want the ******* in the passwordline? Can't remember :">

Thank you..

Edited by YpR^

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can use an input box like so:

$email = InputBox("E-mail Address", "What is your email address?")
$password = InputBox("Password", "What is your password?", "", "*")

And then you can make the script fill in $email & $password.

Edit: I just noticed you have the input boxes. You could make them type in "User name - Password" Then use string split.

Edited by Secure_ICT

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You may want to look at creating a GUI. There is a GFI tool in the Tools section of the SciTe editor.

$ES_READONLY with the GUI Input boxes.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

AutoIT and SciTe is still new to me (and making GUI's) but i'll try to figure it out and read some more :whistle:


Share this post


Link to post
Share on other sites

In Scite Toos -> GUI Builder... very basic and easy :whistle:


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Got both now - i'll try to look into it :whistle:


Share this post


Link to post
Share on other sites

But I'll really recommend to read the helpfile in ALL the GUI... just to get an idea of what you are doing and what you can do - will save you a lot of questions.


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Found a GUI on the net and trying to customize it for my needs. But need some help :whistle:

; TAB
GUICtrlCreateTab(1, 0, 400, 190)
GUICtrlCreateTabItem("Hotmail")
GUICtrlCreateLabel("Login @ Hotmail", 20, 40)
$Input_1 = GuiCtrlCreateInput("@hotmail.com", 120, 70, 140, 20)
$Input_2 = GuiCtrlCreateInput("Password", 120, 100, 140, 20)

#include <IE.au3>

; Create a browser window and navigate to hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

WinSetState("Log på -", "", @SW_MAXIMIZE)

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, $Input_1)
_IEFormElementSetValue($o_password, $Input_2)
Sleep(2000)
_IEFormSubmit($o_form)

Exit

1. problem: The login process starts when i run the script -> so... i need an "OK - button" to accept the Inputs in the boxes before executing the login. <-- Button is now made... just need to link it to execute script.

2. problem: The inserted Password should be hidden in "*" so you can't see it.

Thank you in advance

Edited by YpR^

Share this post


Link to post
Share on other sites

Test this one...

#include <GUIConstants.au3>
#include <IE.au3>

GUICreate('Log på Hotmail.', 200,100)

GUICtrlCreateLabel('Passord:',5,15)
GUICtrlCreateLabel('Email:',5,40)

$password = GUICtrlCreateInput('',50,15,145,17,$ES_PASSWORD)
$email = GUICtrlCreateInput('',50,40,145,17)

$Login = GUICtrlCreateButton('Log på',5,65,190)

GUISetState()



while 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $Login
            ;Logginin.
            _Login()
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd


Func _Login()

$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, GUICtrlRead($email))
_IEFormElementSetValue($o_password, GUICtrlRead($password))
Sleep(100)
_IEFormSubmit($o_form)
    
EndFunc

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

Works great ! Thank you :whistle: I'll try to build onto it....

One question... why can't i "exit" the program ? When pressing CLOSE - nothing happens


Share this post


Link to post
Share on other sites

Case $GUI_EVENT_CLOSE
           Exit
That's incorrect... It's a Select/EndSelect statement, not a Switch/EndSwitch statement.

@OP

It may be that your not out of the _Login() function yet.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Which means ? The close button works if i don't login - but after using the "login" button i'm not able to exit.

What to ad ?

or should i just use the

WinKill("window", "")
:whistle:

another thing i've wondered.... you could make make a drop-down bar with other emails (like gmail, ofir, hotmail, yahoo and so on)

but

could you do this:

make the program READ the string entered in "Email" and decide what to do depending on the surfix after the @?

etc:

if x@hotmail.com is entered the following will be executed:

Func _Login()

$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

WinSetState("Log på -", "", @SW_MAXIMIZE)

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, GUICtrlRead($email))
_IEFormElementSetValue($o_password, GUICtrlRead($password))
Sleep(1000)
_IEFormSubmit($o_form)
   
EndFunc

If y@gmail.com is entered the following will be executed

$oIE = _IECreate()
_IENavigate($oIE, "http://www.gmail.com")

WinSetState("Velkommen til Gmail -", "", @SW_MAXIMIZE)

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "gaia_loginform")
$o_login = _IEFormElementGetObjByName($o_form, "Email")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, $value)
_IEFormElementSetValue($o_password, $value1)
Sleep(2000)
_IEFormSubmit($o_form)
Edited by YpR^

Share this post


Link to post
Share on other sites

GuiCtrlRead is a good start. Here is the code from BetaPad, for the search engine.

Case $Search
            Select
                Case StringInStr(GUICtrlRead($Engine), "Google")
                    ShellExecute("www.google.com/search?q=" & GUICtrlRead($SearchInput))
                Case StringInStr(GUICtrlRead($Engine), "Yahoo")
                    ShellExecute("http://search.yahoo.com/search;_ylt=A0oGki6dHJRFEk0AtBxXNyoA?p=" & GUICtrlRead($SearchInput) & "&prssweb=Search&ei=UTF-8&fr=yfp-t-501&fp_ip=UK&x=wrt&meta=0")
                Case StringInStr(GUICtrlRead($Engine), "Ebay")
                    ShellExecute("http://search.ebay.co.uk/" & GUICtrlRead($SearchInput) & "_W0QQfrppZ50QQfsopZ1QQmaxrecordsreturnedZ300")
                Case StringInStr(GUICtrlRead($Engine), "Sourceforge")
                    ShellExecute("http://sourceforge.net/search/?type_of_search=soft&words=" & GUICtrlRead($SearchInput))
                Case StringInStr(GUICtrlRead($Engine), "Ask")
                    ShellExecute("http://www.ask.com/web?q=" & GUICtrlRead($SearchInput) & "&qsrc=0&o=333&l=dir")
                Case StringInStr(GUICtrlRead($Engine), "Wikipedia")
                    ShellExecute("http://en.wikipedia.org/wiki/" & GUICtrlRead($SearchInput))
                Case Else
                    MsgBox(0, "Error", "Please specify a string and engine to search with.")
            EndSelect

Share this post


Link to post
Share on other sites

Secure_ICT your script is a Searchengine ? I just wanted to search the "$email = GUICtrlCreateInput('',60,15,145,17)" string so that when pressing the login you'll be taken to:

@gmail.com -> gmail.com / @yahoo.com -> mail.yahoo.com / @hotmail / msn.com -> hotmail.com / and so on.


Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Here:

#include <GUIConstants.au3>

$sGUI = GUICreate("DropDown Box Reading", 236, 112, 193, 115)
$Account = GUICtrlCreateCombo("Email Account", 16, 8, 209, 25)
GUICtrlSetData(-1, "GMail|Yahoo|Hotmail|Freeserve|AOL")
$GetMail = GUICtrlCreateButton("Get Email Account", 40, 40, 153, 33, 0)
$Which = GUICtrlCreateInput("", 16, 80, 209, 21)
GUISetState(@SW_SHOW)

While 1
    $sMsg = GUIGetMsg()
    Switch $sMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GetMail
            Select
                Case StringInStr(GUICtrlRead($Account), "GMail")
                    $Advance = GuiCtrlRead($Account)
                    GuiCtrlSetData($Which, $Advance)
                Case StringInStr(GUICtrlRead($Account), "Yahoo")
                    $Advance = GuiCtrlRead($Account)
                    GuiCtrlSetData($Which, $Advance)
                Case StringInStr(GUICtrlRead($Account), "Hotmail")
                    $Advance = GuiCtrlRead($Account)
                    GuiCtrlSetData($Which, $Advance)
                Case StringInStr(GUICtrlRead($Account), "Freeserve")
                    $Advance = GuiCtrlRead($Account)
                    GuiCtrlSetData($Which, $Advance)
                Case StringInStr(GUICtrlRead($Account), "AOL")
                    $Advance = GuiCtrlRead($Account)
                    GuiCtrlSetData($Which, $Advance)
                Case Else
                    MsgBox(0, "Error", "Please specify a string and engine to search with.")
            EndSelect
    EndSwitch
WEnd
Edited by Secure_ICT

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0