Jump to content
Sign in to follow this  
FMS

Sending a input problem

Recommended Posts

FMS

Dear reader,

I´ve a problem whit sending a previous input from a input field... :S

maybe i do something wrong :S

Can anyone help me?

BlockInput (1)
Run("notepad.exe");
WinWaitActive("Untitled - Notepad")
Sleep (5000)
Send($aInput[1][0]) ; <---
Sleep (5000)

    BlockInput (0)

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites
99ojo

Dear reader,

I´ve a problem whit sending a previous input from a input field... :S

maybe i do something wrong :S

Can anyone help me?

BlockInput (1)
Run("notepad.exe");
WinWaitActive("Untitled - Notepad")
Sleep (5000)
Send($aInput[1][0]) ; <---
Sleep (5000)

    BlockInput (0)

Hi,

glasbowl is a little bit foggy today. ;-))

So we don't know what is saved in $aInput [1] [0] ..... (hard to help...)

You may put for debugging reasons a consolewrite ($aInput [1] [0]) before your send.

;-))

Stefan

Share this post


Link to post
Share on other sites
Rishav

an Important note to anyone attempting to solve this.

DO NOT just run the code without reading it first. I ended up restarting my comp. :)

Share this post


Link to post
Share on other sites
FMS

Lol sorry u are right :)

This is what i got so far :)

#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("Marcel's Wachtwoord Changer                                               (MWC @ NVI)", 480, 480)

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

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("", 150, (70 * $i) - 50, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
        $aInput[$i][1] = GUICtrlCreateInput("", 150, (70 * $i) - 20, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
Next

GUICtrlCreateGroup("NEW", 10, 320, 460, 70)
$aInput[0][0] = GUICtrlCreateInput("", 150, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$aInput[0][1] = GUICtrlCreateInput("", 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.")
                        ContinueLoop 2
                    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
                            ; 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")
    BlockInput (1)
    Run("notepad.exe");
    Sleep (5000)
    Send($aInput[1][0]); <-------------------------------------   ****** this :)
    Sleep (5000)
    BlockInput (0)
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

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites
FMS

1st reading is always a must :S

just look at blockinput :)

just kill script is enough lol

or u wait (because of the sleep function) :S

an Important note to anyone attempting to solve this.

DO NOT just run the code without reading it first. I ended up restarting my comp. :)

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites
99ojo

1st reading is always a must :S

just look at blockinput :)

just kill script is enough lol

or u wait (because of the sleep function) :S

Hi,

i think you have to use function ControlSetText instead of Send.

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites
Rishav

i couldn't read the sleep duration because the notepad was covering my scite. T_T

but i think i did wait for 10-15 seconds before shieking like a little girl and killing my comp.

Share this post


Link to post
Share on other sites
FMS

Sorry guys the problem is found but there isn´t a solution yet :)

It´s a little more complicated then before :)

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


as finishing touch god created the dutch

Share this post


Link to post
Share on other sites
FMS

Problem solved thnx 2 KAFU :)

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


as finishing touch god created the dutch

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.