Sign in to follow this  
Followers 0
Arclite86

why cant I login?

8 posts in this topic

#1 ·  Posted (edited)

 

#include <Buttonconstants.au3>
#include <Editconstants.au3>
#include <Guiconstantsex.au3>
#include <staticConstants.au3>
#include <windowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#Region ### START Koda GUI section ### Form=
$GUIT1 = GUICreate  ("hoihallo", 286, 223, 338, 185)
$labelHallo = GUICtrlCreateLabel ("hallo,,,,", 32, 24, 217, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("", 48,80,185,21)
$Input2 = GUICtrlCreateInput("", 48,100,185,21)
$Button = GUICtrlCreateButton("zoek volgers", 64,120,145,49,$WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("guioneventmode",1)
Global $oIE = _IECreate("http://tweepi.com/auth/login",1,0)
Local $username = _IEGetObjByName($oIE, "signin[username]")
Local $password = _IEGetObjByName($oIE, "signin[password]")


While 1
GUICtrlSetOnEvent($Button, "Test")
WEnd



func Test()
$Button = _IECreate("http://tweepi.com/auth/login")
$username = GUIctrlread($Input)
$password = GUICtrlRead($input2)
$username = _IEFormElementSetValue
$username = _IEFormElementSetValue


GUICtrlSetData($labelHallo,("numbers:"),$username)

EndFunc

i try to loging intro this website with the input and input2 as username and password

I have used the function GUIctrlread to read $Input and $input and than past it in the website box

(locate: Local $username = _IEGetObjByName($oIE, "signin[username]")

so $username = what you type in input ..right

but when i try to start and i type: jack8797 in the input

then it is not filling in the username "jack8797"

what am  i doing wrong?

Edited by Arclite86

Share this post


Link to post
Share on other sites



According to the example in the AutoIt help on GUICtrlSetOnEvent, you're not supposed to register it again and again, you just call it once before your while loop, this way

GUICtrlSetOnEvent(-1, "test")

;...

    ; Just idle around
    While 1
        Sleep(10)
    WEnd

Share this post


Link to post
Share on other sites

According to the example in the AutoIt help on GUICtrlSetOnEvent, you're not supposed to register it again and again, you just call it once before your while loop, this way

GUICtrlSetOnEvent(-1, "test")

;...

    ; Just idle around

    While 1

        Sleep(10)

    WEnd

still doesn't work

i have tried this:

#include <Buttonconstants.au3>
#include <Editconstants.au3>
#include <Guiconstantsex.au3>
#include <staticConstants.au3>
#include <windowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#Region ### START Koda GUI section ### Form=
$GUIT1 = GUICreate  ("hoihallo", 286, 223, 338, 185)
$labelHallo = GUICtrlCreateLabel ("hallo,,,,", 32, 24, 217, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("", 48,80,185,21)
$Input2 = GUICtrlCreateInput("", 48,100,185,21)
$Button = GUICtrlCreateButton("zoek volgers", 64,120,145,49,$WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("guioneventmode",1)
Global $oIE = _IECreate("http://tweepi.com/auth/login",1,0)
Local $username = _IEGetObjByName($oIE, "signin[username]")
    Local $password = _IEGetObjByName($oIE, "signin[password]")


While 1
    Sleep(10)
    GUICtrlSetOnEvent($Button, "Test")

    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

WEnd

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE

            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE


        Case @GUI_CtrlId = $GUI_EVENT_RESTORE


    EndSelect
EndFunc   ;==>SpecialEvents




func Test()
    $Button = _IECreate("http://tweepi.com/auth/login")
    $username = GUIctrlread($Input)
    $password = GUICtrlRead($input2)
    $username = _IEFormElementSetValue
    $username = _IEFormElementSetValue


    GUICtrlSetData($labelHallo,("numbers:"),$username)

    EndFunc

and this:

#include <Buttonconstants.au3>
#include <Editconstants.au3>
#include <Guiconstantsex.au3>
#include <staticConstants.au3>
#include <windowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#Region ### START Koda GUI section ### Form=
$GUIT1 = GUICreate  ("hoihallo", 286, 223, 338, 185)
$labelHallo = GUICtrlCreateLabel ("hallo,,,,", 32, 24, 217, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("", 48,80,185,21)
$Input2 = GUICtrlCreateInput("", 48,100,185,21)
$Button = GUICtrlCreateButton("zoek volgers", 64,120,145,49,$WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("guioneventmode",1)
Global $oIE = _IECreate("http://tweepi.com/auth/login",1,0)
Local $username = _IEGetObjByName($oIE, "signin[username]")
    Local $password = _IEGetObjByName($oIE, "signin[password]")


While 1
    Sleep(10)
    GUICtrlSetOnEvent(-1, "Test")

    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

WEnd

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE

            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE


        Case @GUI_CtrlId = $GUI_EVENT_RESTORE


    EndSelect
EndFunc   ;==>SpecialEvents




func Test()
    $Button = _IECreate("http://tweepi.com/auth/login")
    $username = GUIctrlread($Input)
    $password = GUICtrlRead($input2)
    $username = _IEFormElementSetValue
    $username = _IEFormElementSetValue


    GUICtrlSetData($labelHallo,("numbers:"),$username)

    EndFunc

but they both dont work....

Share this post


Link to post
Share on other sites

You should remove the GUICtrlSetOnEvent from the loop, set it once and you're done. Also, -1 only works for the last control created, fortunately for you, that was the button.

Here's your script with a working button and unnecessary control information removed.

#include <Buttonconstants.au3>
#include <Editconstants.au3>
#include <Guiconstantsex.au3>
#include <staticConstants.au3>
#include <windowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#Region ### START Koda GUI section ### Form=
$GUIT1 = GUICreate("hoihallo", 286, 223, 338, 185)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
$labelHallo = GUICtrlCreateLabel("hallo,,,,", 32, 24, 217, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("", 48, 80, 185, 21)
$Input2 = GUICtrlCreateInput("", 48, 100, 185, 21)
$Button = GUICtrlCreateButton("zoek volgers", 64, 120, 145, 49, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Test")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $oIE = _IECreate("http://tweepi.com/auth/login", 1, 0)
Local $username = _IEGetObjByName($oIE, "signin[username]")
Local $password = _IEGetObjByName($oIE, "signin[password]")
Opt("guioneventmode", 1)

While 1
    Sleep(10)

WEnd

Func SpecialEvents()
    Exit
EndFunc   ;==>SpecialEvents




Func Test()
    $Button = _IECreate("http://tweepi.com/auth/login")
    $username = GUICtrlRead($Input)
    $password = GUICtrlRead($Input2)
    $username = _IEFormElementSetValue
    $username = _IEFormElementSetValue

    GUICtrlSetData($labelHallo, ("numbers:"), $username)

EndFunc   ;==>Test

The _IE stuff I'll leave to someone else as that's not my forte.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Look into the source code of the page:
 
For the below example I found (not all in the same spot):
<input class="portlet_login_field" type="Text" name="userid" value="" size="28" maxlength="80" tabindex="777">
<input class="portlet_login_field" type="Password" name="password" value="" size="28" maxlength="40" tabindex="778">
<input class="portlet_login_button" type="Submit" name="submit" tabindex="779" value="   Login   " border="0" valign="top">

So I find out from that that the Form´s name is "signup",

the Usename Input Element is called "userid"

the Password Input Element is called "password"

and the Submit button is called "submit".

 

For your website check this yourself, and update the below.

$g_oIE = _IECreate("http://tweepi.com/auth/login")


$sYourUserName = GUICtrlRead($Input)
$sYourPassword = GUICtrlRead($Input2)

$oForm = _IEFormGetObjByName($g_oIE, "signup")

$oFormElement = _IEFormElementGetObjByName($oForm, "userid")
_IEFormElementSetValue($oFormElement, $sYourUserName)

$oFormElement = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oFormElement, $sYourPassword)

$oFormElement = _IEFormElementGetObjByName($oForm, "submit")
_IEAction($oFormElement, "click")
_IELoadWait($g_oIE)
Edited by guestscripter

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thank you very much, but i am getting kinda confused this is what i made

#include <Buttonconstants.au3>
#include <Editconstants.au3>
#include <Guiconstantsex.au3>
#include <staticConstants.au3>
#include <windowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#Region ### START Koda GUI section ### Form=
$GUIT1 = GUICreate("hoihallo", 286, 223, 338, 185)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
$labelHallo = GUICtrlCreateLabel("hallo,,,,", 32, 24, 217, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("", 48, 80, 185, 21)
$Input2 = GUICtrlCreateInput("", 48, 100, 185, 21)
$Button = GUICtrlCreateButton("zoek volgers", 64, 120, 145, 49, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Test")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $oIE = _IECreate("http://tweepi.com/auth/login", 1, 0)
Local $username = _IEGetObjByName($oIE, "signin[username]")
Local $password = _IEGetObjByName($oIE, "signin[password]")
Opt("guioneventmode", 1)

While 1
    Sleep(10)

WEnd

Func SpecialEvents()
    Exit
EndFunc






func Test()
$g_oIE = _IECreate("http://tweepi.com/auth/login")


$sYourUserName = GUICtrlRead($Input)
$sYourPassword = GUICtrlRead($Input2)

$oForm = _IEFormGetObjByName($g_oIE, "signup")

$oFormElement = _IEFormElementGetObjByName($oForm, "signin[username]")
_IEFormElementSetValue($oFormElement, $sYourUserName)

$oFormElement = _IEFormElementGetObjByName($oForm, "signin[password]")
_IEFormElementSetValue($oFormElement, $sYourPassword)

$oFormElement = _IEFormElementGetObjByName($oForm, "submit")  ;not very importend right now
_IEAction($oFormElement, "click")
_IELoadWait($g_oIE)

    EndFunc
 

i understand that $syourusername will read the input ( what i type in the form)

but i dont understand why the "userid" place,  it reads from the form and chances it intro.something else why??

when i start it , it wont put the text in the "signin[username]" on the website: http://tweepi.com/auth/login. which is the 

username input. i dont understand why it is not working.. can somebody please detect this problem and

gives me a updated version that will work directly because i failed updating it, I would be very thankfull

Edited by Arclite86

Share this post


Link to post
Share on other sites

Well done with taking a look at the source already to find your element names the "signin[username]" and "signin[password]" already.

I see though that you didn´t change the form name from my example, which I now see was probably because there isn´t one.

<form id="login_form" class="biginsform" action="/auth/signin" method="post">

       <input type="text" name="signin[username]" class="shadow_input biginput lightgray" title="you@example.com" id="signin_username">

       <input type="password" name="signin[password]" class="shadow_input biginput" title="Type your password" id="signin_password">
     
       <a id="submit_btn" href="#x" class="btn btn_smaller btn_orange inline_block btn_submit_form">Login »</a>          

</form>

The good news is that there are workarounds to getting objects by names. In this case for example using the ID.

Replace $oForm = _IEFormGetObjByName($g_oIE, "signup")

With $oForm = _IEGetObjById($g_oIE, "login_form")

and do some reading in the helpfile about all the different IE functions,

and then even more reading here:

http://msdn.microsoft.com/en-us/library/hh772960(v=vs.85).aspx

before asking for more work to be done for you :-)

Share this post


Link to post
Share on other sites

thank you so much, i forgot the "$oform" is connected with the first "signup" line

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