Jump to content

in the end a diffrent global input :S


 Share

Recommended Posts

Dear reader,

I have here a problem that i can´t solve :S

Iff u look at this script u will c that the input fields are checked for iff the are diffrent then the other.

iff u put in diffrent inputs there is a error message,

but in the end iff i send the inputs to notepad i don´t got the data the i put in before:S

instead of that i get for each input [1][0],[1][1] till [4][0],[4][1] : 5,6,9,10,13,14,17,18

I hope anyone c the problem :)

thnx in advanced :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $aCheckbox[5]
Global $aInput[5][2]
Global $aArray[5]
$hGUI = GUICreate("MWC", 480, 480)

$aArray[1]="Program 1"
$aArray[2]="Program 2"
$aArray[3]="Program 3"
$aArray[4]="Program 5"

For $i = 1 To 4 step 1
        GUICtrlCreateGroup("OLD", 10, (70 * $i) - 60, 460, 70)
        $aCheckbox[$i] = GUICtrlCreateCheckbox($aArray[$i], 20, (70 * $i) - 40, 130, 20)
        $aInput[$i][0] = GUICtrlCreateInput("inputold", 150, (70 * $i) - 50, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
        $aInput[$i][1] = GUICtrlCreateInput("inputold", 150, (70 * $i) - 20, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
Next

GUICtrlCreateGroup("NEW", 10, 320, 460, 70)
$aInput[0][0] = GUICtrlCreateInput("123456&", 150, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$aInput[0][1] = GUICtrlCreateInput("123456&", 150, 360, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Cancel", 140, 400, 80, 30)
$Button2 = GUICtrlCreateButton("Change", 260, 400, 80, 30)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

$iCheckCount = 0
While 1

    Switch GUIGetMsg()
        Case $Button2 ;Change
            For $i = 1 To 4
                If BitAnd(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
                    If GUICtrlRead($aInput[$i][0]) = "" Or GUICtrlRead($aInput[$i][1]) = "" Then
                        MsgBox(0, "MWC", "Vul uw oude wachtwoord van " & $aArray[$i] & " in aub.")
                        MsgBox (0,"",$aInput[$i][0]);<------------------------------------------------------here are the input fields already wrong :S
                        ContinueLoop 2              ;but the the reading of these fields are correct :S the inputs are here 5,9,13,17
                    EndIf
                    If GUICtrlRead($aInput[$i][0]) <> GUICtrlRead($aInput[$i][1]) Then
                        MsgBox(0, "MWC", "Uw wachtwoorden van " & $aArray[$i] & " komen niet overeen" )
                        ContinueLoop 2
                    EndIf
                    $iCheckCount = 1
                EndIf
            Next
            If GUICtrlRead($aInput[0][0]) = "" Or GUICtrlRead($aInput[0][1]) = "" Then
                MsgBox(0, "MWC", "Vul uw nieuwe wachtwoorden in AUB.")
                ContinueLoop
            EndIf
            If GUICtrlRead($aInput[0][0]) <> GUICtrlRead($aInput[0][1]) Then
                MsgBox(0, "MWC", "Uw nieuwe wachtwoorden komen niet overeen")
                ContinueLoop
            EndIf
            If Check_PW() = 0 Then
                MsgBox(0, "MWC", "Uw nieuwe wachtwoord is niet goed" & @CRLF & @CRLF & "wachtwoord moet minimaal bestaan uit 7 tekens met daarin minimaal 2 cijfers" & @CRLF & "minimaal 1 speciale teken en niet hetzelfde als een oud wachtwoord "&  @CRLF & @CRLF & "Tip hierbij is om tekens als letters te gebruiken."&  @CRLF & "@ = a , 3 = e , ! = i , $ = s , & = en , 0 = o enz."   & @CRLF &  @CRLF & "b.v.:" &  @CRLF & "P@ssw00rd = passwoord                @ut0matis3ring = Automatisering" &  @CRLF & "M!cr0s0ft = Microsoft                Welk*m01 = welkom01"&  @CRLF & "C0mput3r. = computer.                D1kk3&dunne = dikke & dunne")
                GUICtrlSetData($aInput[0][0], "")
                GUICtrlSetData($aInput[0][1], "")
                ContinueLoop
            EndIf
            If $iCheckCount Then
                MsgBox(0, "MWC", "alle wachtwoorden kloppen... ")
                For $i = 1 To 4
                    If BitAnd(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
                        ; Check PW are not identical
                        If GUICtrlRead($aInput[$i][0]) = GUICtrlRead($aInput[0][0]) Then
                            MsgBox(0, "MPC", "New PW matches old PW for App " & $i)
                            ContinueLoop 2
                        Else
                            MsgBox (0,"",$aInput[$i][0])

                            ; Run PW changing function for app $i
                            Call("PW_Change" & $i)
                        EndIf
                    EndIf
                Next
            Else
                MsgBox(0,"(MWC","Er is geen Checkbox aangevinkt" ,4)
            EndIf
        Case $Button1 ;Cancel
            MsgBox(0, "MPC", "You clicked cancel! Exiting...")
            Exit
        Case $GUI_EVENT_CLOSE
            MsgBox(0, "MPC", "You clicked CLOSE! Exiting...", 2)
            Exit
    EndSwitch
WEnd

Func PW_Change1()
    MsgBox(0, "MPC", "Uw wachtwoord van " & $aArray[1] & " word nu veranderd")

EndFunc

Func PW_Change2()
    MsgBox(0, "MPC", "Uw wachtwoord van " & $aArray[2] & " word nu veranderd")
    Run("notepad.exe");****************************************************************************Here u c the input in clear text
    Sleep (3000)
    send ($aInput[1][0])
    Send(",")
    send ($aInput[1][1])
    Send(",")
    send ($aInput[2][0])
    Send(",")
    send ($aInput[2][1])
    Send(",")
    send ($aInput[3][0])
    Send(",")
    send ($aInput[3][1])
    Send(",")
    send ($aInput[4][0])
    Send(",")
    send ($aInput[4][1])

EndFunc

Func PW_Change3()
    MsgBox(0, "MPC", "Uw wachtwoord van " & $aArray[3] & " word nu veranderd")
    ;**************************************************************************
EndFunc

Func PW_Change4()
    MsgBox(0, "MPC", "Uw wachtwoord van " & $aArray[4] & " word nu veranderd")
    ; *************************************************************************
EndFunc

Func Check_PW()
    ; WW check

    Local $iMinLength = 7
    Local $iDigits = 2
    Local $iSpecialChars = 1

    Local $sRegExp = "^.*(?=.{" & $iMinLength & ",})(?=.*[[:digit:]]{" & $iDigits & ",})(?=.*[[:punct:]]{" & $iSpecialChars & ",}).*$"
    Return StringRegExp(GUICtrlRead($aInput[0][0]), $sRegExp)

EndFunc
Edited by FMS

as finishing touch god created the dutch

Link to comment
Share on other sites

You're sending the controlIDs, not the values of the controls... try something like Send(GUICtrlRead($aInput[1][0]))...

YESSSSsssssssssszzzzzzzzzzzz that was the problem :)

thnx :)

for other reader,.... u need to send the data raw otherwise u dont get what u need;)

send(GUICtrlRead($aInput[1][0]),1)

as finishing touch god created the dutch

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...