Sign in to follow this  
Followers 0
ExiLeD4EveR

Having trouble with data from an input box

5 posts in this topic

'm trying to make an autologin script for facebook which prompts u to enter an email and a password and then opens the browser and logs you with the info u entered but im having a problem with the text entered in the input box. What i basically want it to do is take what's written on the inputbox and replace it on the email form in the facebook site and the password. Don't mind the other buttons in the gui , i just wanted to focus on the facebook button first. Any help will be appreciated

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=c:\users\ExiLeD\desktop\coding\autoit\gui samples\simplegui.kxf
$SimpleGUI = GUICreate("MultiProgram", 392, 122, -1, -1)
GUISetIcon("C:\Users\ExiLeD\Desktop\Work\Smile\Icon Pack\EcranLcd.ico", -1)
$Notepad = GUICtrlCreateButton("Notepad", 16, 24, 73, 25)
GUICtrlSetCursor (-1, 0)
$Calculator = GUICtrlCreateButton("Calculator", 112, 24, 73, 25)
GUICtrlSetCursor (-1, 0)
$ExitButoon = GUICtrlCreateButton("Exit", 160, 72, 73, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
$Lol = GUICtrlCreateButton("Lol Login", 208, 24, 73, 25)
GUICtrlSetCursor (-1, 0)
$Facebook = GUICtrlCreateButton("Facebook ", 304, 24, 73, 25)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Facebook ;= if Facebook is pressed it creates the email form
            $Face_Login = GUICreate("Facebook Login", 295, 88, -1, -1)
            GUISetIcon("C:\Users\ExiLeD\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1)
            $Label1 = GUICtrlCreateLabel("Email", 40, 24, 29, 17)
            $InputBox1 = GUICtrlCreateInput("", 72, 21, 148, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
            $data1 = GUICtrlRead(-1)
            $Email_button = GUICtrlCreateButton("Done", 96, 56, 97, 25)
            GUISetState(@SW_SHOW)


            While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $Email_button ;= if Done from email form is pressed then delete the email form and open the password form
                        GUIDelete($Face_Login)
                        Sleep(200)
                        $Face_Login2 = GUICreate("Facebook Login", 295, 88, -1, -1)
                        GUISetIcon("C:\Users\ExiLeD\Downloads\Iconshock-Social-Media-Beakers-Facebook.ico", -1)
                        $Label2 = GUICtrlCreateLabel("Password", 16, 24, 50, 17)
                        $InputBox2 = GUICtrlCreateInput("", 72, 21, 148, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
                        $data2 = GUICtrlRead(-1)
                        $Pass_button = GUICtrlCreateButton("Done", 96, 56, 97, 25)
                        GUISetState(@SW_SHOW)



                        While 1
                            $nMsg = GUIGetMsg()
                            Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                    Exit
                                Case $Pass_button ;= if Done from password form is pressed then it deletes the password form and , to add(open internet explorer on the facebook login page
                                    GUIDelete($Face_Login2)
                                    FB_SignIn()
                            EndSwitch
                        WEnd



                EndSwitch
            WEnd



    EndSwitch
WEnd

Func FB_SignIn()

    Global $oIE = _IECreate("https://www.facebook.com/")

    Local $username = _IEGetObjByName($oIE, "email")
    Local $password = _IEGetObjByName($oIE, "pass")
    Local $button = _IEGetObjById($oIE, "loginbutton")

    _IEFormElementSetValue($username, $data1)
    _IEFormElementSetValue($password, $data2)

    _IEAction($button, "click")

EndFunc

 

Share this post


Link to post
Share on other sites



You're reading the information from the Input control in the wrong places, you're reading them as soon as you've created them. You need to read the contents AFTER you've hit the button to log in. The 2  variables $data 1 and $data2 will both be empty, so nothing will be working the way you want them to.


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
1 hour ago, BrewManNH said:

You're reading the information from the Input control in the wrong places, you're reading them as soon as you've created them. You need to read the contents AFTER you've hit the button to log in. The 2  variables $data 1 and $data2 will both be empty, so nothing will be working the way you want them to.

Thanks a lot for helping me out. One more question although i think i already know the answer. Can the text entered on an input form be with * (Need it for the password form). Or should i choose the InputBox function instead ? 

Share this post


Link to post
Share on other sites

Use the  $ES_PASSWORD style setting when creating the Input control.

Although in my opinion, there's almost never a need to mask the password entry, usually because there's almost never anyone looking over your shoulder when you're putting it in. I've always found it to be more of a pain in the ass to enter a password and fat finger something, and have to erase the whole entry because you don't know what you've already typed. 


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

Didn't even know that existed cause it wasn't in the style settings i just put it there manually and works great. Well it's cooler that way :D . Thanks a lot BrewManNH, the facebook button is completed and will move one to making other things too !

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

  • Similar Content

    • X_xkijux_x
      By X_xkijux_x
      Ok so im using this program. clarify for school. I would like to have a program that takes every word i type in microsoft word and searches on it in claryfi. is this possible. I would like to have the program not stopping me from typing more after that word. Like when i type a word it auto search it on clarify without making me stop typing and if i want to change i can do that and if im fine that word i can just keep typing and it will search after the next word. 
    • Miliardsto
      By Miliardsto
      Is this possible to make program works like in diagram? There is so much encryption methods and UDFs are they give security? If the $Address will be crypted with some encryption algorithm could be possible to get the value of $Address in easy way? Of course We know its easy too look into autoit code and get value of variable and so We dont want to anyone see $Address value - there are functions Could func1.au3, func2.au3.. be for example func1.php or other type of file? As we know .php files are unnable to see. For example func1 would be read by FileRead() and then Execute() Is this generally possible to do?
      Will it give secure?
      What do you think about? Maybe there is something wrong in this concept or missed.

    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )

       
    • nassausky
      By nassausky
      Hey all,
      Has anyone created any queries for youtube? I was thinking it might be something like this but can't quite figure it out:
      $oIE = _IECreateEmbedded() _IENavigate($oIE,"https://www.youtube.com") Local $oForms = _IETagNameGetCollection($oIE, "form") Local $sTxt = "" For $oForm In $oForms If $oForm.id = "masthead-search" Then $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id = "masthead-search-term" Then _IEFormElementSetValue($oInput, "cards") _IEFormSubmit($oForm) EndIf Next EndIf Next  
    • Skysnake
      By Skysnake
      Scite comes up occasional, almost incidentally, in some support topics.  I have not found a "Scite" topic in the forums, so this is where I will start.  I have recently been using Scite intensively, specifically with a large project and I have certain issues.  I know that Scite is not an AutoIt product, but it is so closely integrated to the core release that it makes sense to raise issues and request support here.  If this is not the right please refer me to the right forum.
      Thx
       
      Skysnake