Jump to content
Advert

Recommended Posts

Posted (edited)

I'm seeking help on creating some sort of tab that is connected to the login GUI that allows the user to save his/ or her email and password information and later allow the user to select again at a later period of time. 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <GDIPlus.au3>
#include <guiconstants.au3>
HotKeySet("{ESC}", "Terminate")

Global $x ;#Func Email
Global $y ;#Func Password
Global $hGUI, $iLogin, $iPassword, $iUserName, $nMsg

_Login()

Func _Login()

    $hGUI = GUICreate("Test Login", 210, 100, -1, -1, 0x16C80000, 0x00000181)
    $iUserName = GUICtrlCreateInput("Enter Email", 5, 5, 200, 20, 0x01)
    $iPassword = GUICtrlCreateInput("Password", 5, 30, 200, 20, 0x21)
    $iLogin = GUICtrlCreateButton("Login", 50, 55, 100, 20)
    $existing = GUICtrlCreateButton("Existing", 155, 55, 50, 20)
    $save = GUICtrlCreateButton("Save", 155, 80, 50, 20)
    GUISetState(@SW_SHOW, $hGUI)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg

            Case $iLogin

                If GUICtrlRead($iUserName) And GUICtrlRead($iPassword) Then
                    Return $iUserName
                    Return $iPassword
                    GUIDelete()
                    ExitLoop
                Else
                    MsgBox(0, "Login", "Enter Email and password")
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_Login

Local $iWidthCell = 70 ;#GUI Create

$width = 1050 ;#GUI Create
$height = 771 ;#GUI Create

$hMain = GUICreate("Test", 1024, 600, @DesktopWidth / 2 - $width / 2, @DesktopHeight / 2 - $height / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

;#IE Create
Func internet()
    Local $oIE = _IECreateEmbedded()
    $width1 = 1050
    $height1 = 771
    GUICtrlCreateObj($oIE, 0, -150, $width1 + 270, $height1 + -50)
    _IENavigate($oIE,)  ;#<WEB LINK>

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

    _IEFormElementSetValue($username, $x)
    _IEFormElementSetValue($password, $y)
    ;$oBtn = _IEGetObjById($oIE, "u_0_x") ; works on the main login page
    ;$oBtn = _IEGetObjById($oIE, "u_0_2") ; works on the second login page
    ;_IEAction($oBtn, "click")
EndFunc   ;==>internet

Local $RunProgram = GUICtrlCreateButton("Open IE", 900, 170, 85, 25)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        Case $GUI_EVENT_CLOSE, $idClose

            ExitLoop

        Case $RunProgram

            $ClearID = "255"
            ;#Removes all saved internet data
            ;RunWait(@ComSpec & " /C RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255", "", @SW_MINIMIZE, @SW_MINIMIZE);
            $x = GUICtrlRead($iUserName)
            $y = GUICtrlRead($iPassword)
            internet()
    EndSwitch

WEnd

;#Calls texts from Inputs
Func Email($x)
    $x = ControlGetText(WinGetTitle("[AutoIt v3 GUI]"), "", "[CLASS:Edit; INSTANCE:1]")
EndFunc   ;==>Email
;#Calls texts from Inputs
Func Password($y)
    $y = ControlGetText(WinGetTitle("[AutoIt v3 GUI]"), "", "[CLASS:Edit; INSTANCE:2]")
EndFunc   ;==>Password

Func IEUtils_Delete()
    WinActivate("[CLASS:IEFrame]")
    Send("^+{DEL}") ; ctrl shift delete to bring up browsing history
    Sleep(1000)
    Send("!d") ; alt d to delete
    Sleep(1000)
EndFunc   ;==>IEUtils_Delete

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Edited by aa2zz6
Advert

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
×
×
  • Create New...