Jump to content

Need some help to my GUI LoginUsername/Password


Bishop12
 Share

Recommended Posts

HI Guys im Trying to Find out how can i Get  what inside Input_username or Input_password i mean is when i open GUI and Put like something else i want in user name like  Test and password is 123456 i want is after i click Login Button func main() should activate notepad and send the user and password i put in GUI Login my problem is yes it was sending But only number 4 and 6 may be i miss something else or what little bit newbie in Autoit need some one to help thankyou. HERES my little example 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=d:\all drivers files\koda\forms\gui login.kxf
$Form1_1 = GUICreate("Form1", 340, 148, 207, 124)
$Label1 = GUICtrlCreateLabel("Password", 32, 56, 50, 17)
$ip_password = GUICtrlCreateInput("", 104, 56, 105, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Label2 = GUICtrlCreateLabel("UserName", 32, 16, 54, 17)
$ip_username = GUICtrlCreateInput("", 104, 8, 105, 21)
$Login = GUICtrlCreateButton("Login", 96, 88, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Login
       main()
       Exit

    EndSwitch
WEnd





Func main()
   WinActivate("Untitled - Notepad")
   sleep(500)
   Send($ip_password,0)
   sleep(500)
   Send("{ENTER}",0)
   Send($ip_username,0)
   sleep(500)
EndFunc

 

Edited by Bishop12
Link to comment
Share on other sites

Send is not reliable without adjusting the input speed and pause between characters to exactly match what every application you send at can handle (all applications are different)...use:

 

Func main()
    $h = WinActivate("Untitled - Notepad")
    $c = ControlGetHandle($h,"",15)
    ControlSetText($h,"",$c,$ip_password & @CRLF & $ip_username)
EndFunc

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

5 minutes ago, jdelaney said:

Send is not reliable without adjusting the input speed and pause between characters to exactly match what every application you send at can handle...use:

 

Func main()
    $h = WinActivate("Untitled - Notepad")
    $c = ControlGetHandle($h,"",15)
    ControlSetText($h,"",$c,$ip_password & @CRLF & $ip_username)
EndFunc

 

i try it already it was still sending only number 4 and 6 i dont know why i cant get the text or user or password i wrote in GUI login user and password. :( i type in GUI login User is yes and in password is 123 and hit login and activate notepad then only 4 and 6 number showing not the message or user password i wrote in GUI

Edited by Bishop12
Link to comment
Share on other sites

sorry, didn't notice you were not reading in the variables, but just sending the control ids

Local $sLogin = ""
Local $sPassword = ""
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Login
            $sPassword = GUICtrlRead($ip_password)
            $sLogin = GUICtrlRead($ip_username)
            main($sLogin,$sPassword)
       Exit

    EndSwitch
WEnd


Func main($login,$pass)
    $h = WinActivate("Untitled - Notepad")
    $c = ControlGetHandle($h,"",15)
    ControlSetText($h,"",$c,$pass & @CRLF & $login)
EndFunc

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

1 hour ago, jdelaney said:

sorry, didn't notice you were not reading in the variables, but just sending the control ids

Local $sLogin = ""
Local $sPassword = ""
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Login
            $sPassword = GUICtrlRead($ip_password)
            $sLogin = GUICtrlRead($ip_username)
            main($sLogin,$sPassword)
       Exit

    EndSwitch
WEnd


Func main($login,$pass)
    $h = WinActivate("Untitled - Notepad")
    $c = ControlGetHandle($h,"",15)
    ControlSetText($h,"",$c,$pass & @CRLF & $login)
EndFunc

 

ohh i see ill try it in few mns just doing something thankyou in advance again sir thankyou so much in fast reply and help 

Link to comment
Share on other sites

On 4/11/2019 at 11:13 AM, jdelaney said:

sorry, didn't notice you were not reading in the variables, but just sending the control ids

Local $sLogin = ""
Local $sPassword = ""
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Login
            $sPassword = GUICtrlRead($ip_password)
            $sLogin = GUICtrlRead($ip_username)
            main($sLogin,$sPassword)
       Exit

    EndSwitch
WEnd


Func main($login,$pass)
    $h = WinActivate("Untitled - Notepad")
    $c = ControlGetHandle($h,"",15)
    ControlSetText($h,"",$c,$pass & @CRLF & $login)
EndFunc

 

Its now working SIR :D thankyou so much :) 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...