Sign in to follow this  
Followers 0
logi

Automatic website login.

8 posts in this topic

Hello everyone,

Just starting to script so i need your help :) ,

I was looking at the function _IE but couldn't figure out how it worked..

I want to log-in at www.ogame.nl, is this possible with _IE ? and if it is, how could i do it?

Share this post


Link to post
Share on other sites



Logi,

Have you pulled it off yet?

Post your OGame name and UNI and I'll get back to you...

Share this post


Link to post
Share on other sites

Hi,

start with:

#include <IE.au3>
$sUsername = "Username"
$sPassword = "Password"
$sUrl = "http://www.xxx.xx"
$oIE = _IECreate ($sUrl)
$oHWND = _IEPropertyGet($oIE, "hwnd")
WinSetState ($oHWND, "", @SW_MAXIMIZE )
$oForm = _IEFormGetCollection ($oIE, 0)
$oUsername = _IEFormElementGetObjByName ($oForm, "username")
$oPassword = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oUsername, $sUsername)
_IEFormElementSetValue ($oPassword, $sPassword)
_IEFormSubmit ($oForm)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Mega

Help file example does not work & this does. Great thanx.

But I have a question take alook at this, if it finally opens the page & logs in, Nothing works anymore(if i press close button or any other one nothing happens) any idea why ?

#include <IE.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)  ; Change GUI to OnEvent mode

$mainwindow = GUICreate("LAbel", 400, 90)                       ; main GUI window
$write_INI_button = GUICtrlCreateButton("login", 5, 34, 50, 20)   ;Browse Button

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; if  u close GUI it will exit
GUICtrlSetOnEvent($write_INI_button, "Write_ini_func")            ; so if u press save then save function is called-
GUISetState(@SW_SHOW)                                           ; makes Gui Visible

;~ ------------------------------------------------------------------------------------------
Func Write_ini_func()  

                $oIE = _IECreate ("http://www.rate.ee/show.php",1)
                sleep(1000)
                $o_form = _IEFormGetObjByName ($oIE, "loginform")
                $o_user = _IEFormElementGetObjByName ($o_form, "username")
                $o_password = _IEFormElementGetObjByName ($o_form, "password")
                    
                    $username = "user"
                    $password = "pass"

                    ; Set field values and submit the form
                        _IEFormElementSetValue ($o_user, $username)
                        _IEFormElementSetValue ($o_password, $password)
                        _IEFormSubmit ($o_form)
EndFunc   
;~ ------------------------------------------------------------------------------------------

Func CLOSEClicked()   ;Exit GUI function
    Exit            
EndFunc   

While 1  
    Sleep(100)   ; Just idle around
WEnd

Share this post


Link to post
Share on other sites

I got so fed up with repeatedly doing this, I created a little automation to write the script for you.

Its till the same, even with that generated script, after it loggs in the webpage, the Gui stops reacting on anay action.

Share this post


Link to post
Share on other sites

Its till the same, even with that generated script, after it loggs in the webpage, the Gui stops reacting on anay action.

BUMP*

Well it took hours of forum serching but I guess This seems to solve the problem I added 5 lines(I dont really understand the meaning of some lines I added, So dont ask me.... but it seems to be working now.)

The console still gives a Warning:(I dont think it bad though... ) Eather way hire is the code:

--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch

#include <IE.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)  ; Change GUI to OnEvent mode

AutoItSetOption("WinTitleMatchMode", 2)                             ;ADDED line---<<<<<<<<<<<<<<<<<

$mainwindow = GUICreate("LAbel", 400, 90)                  ; main GUI window
$write_INI_button = GUICtrlCreateButton("login", 5, 34, 50, 20)   ;Browse Button

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; if  u close GUI it will exit
GUICtrlSetOnEvent($write_INI_button, "Write_ini_func")            ; so if u press save then save function is called-
GUISetState(@SW_SHOW)                                           ; makes Gui Visible

;~ ------------------------------------------------------------------------------------------
Func Write_ini_func()  

                $oIE = _IECreate ("http://www.rate.ee/login.php",1)
                $wintitle = "Rate.ee"                               ;ADDED line---<<<<<<<<<<<<<<<<<
                winwait($wintitle)                                          ;ADDED line---<<<<<<<<<<<<<<<<<
                WinSetState($wintitle,"", @SW_MAXIMIZE)             ;ADDED line---<<<<<<<<<<<<<<<<<

                $o_form = _IEFormGetObjByName ($oIE, "loginform")
                $o_user = _IEFormElementGetObjByName ($o_form, "username")
                $o_password = _IEFormElementGetObjByName ($o_form, "password")
                    
                    $username = "user"
                    $password = "pass"

                    ; Set field values and submit the form
                        _IEFormElementSetValue ($o_user, $username)
                        _IEFormElementSetValue ($o_password, $password)
                        _IEFormSubmit ($o_form)
                        
                        _IELoadWait ($oIE)                      ;ADDED line---<<<<<<<<<<<<<<<<<
EndFunc   
;~ ------------------------------------------------------------------------------------------

Func CLOSEClicked()   ;Exit GUI function
    Exit            
EndFunc   

While 1  
    Sleep(100)   ; Just idle around
WEnd

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