Sign in to follow this  
Followers 0
FMS

Read previous window and change input.

3 posts in this topic

#1 ·  Posted (edited)

Dear reader,

I´m making a script to change password of multiple programs at once.

Therefore i maked a GUI to put in you old password($aInput[2][0])

I´ve got a problem whit this $aInput[2][0].

The problem is that iff further in the scipt the input is wrong,

(how ofthen is that the problem that the pass are wrong:S)

the second time and the third time the script asks for input[2][0] it is again wrong.

So now is mine question.....

Can i change $ainput[2][0] ????

Iff u C this script below u c that i read the field where the pass is typed in by the user.

But now change $text to $aInput[2][0] for making further conflicts gone.

If ProcessExists("nlnotes.exe") Then
        ;BlockInput (1)
        Run("C:\Program Files\lotus\notes\Notes.exe")
        While not WinActive("[CLASS:NOTES]", "")
            Sleep(10)
        WEnd
        Send("{ALTDOWN}");buttons to press to go to the password security window to change your password.
        Send("f")
        Send("y")
        Send("s")
        Send("{ALTUP}")
        While not WinActive("Lotus Notes")
            Sleep(10)
        WEnd
        send(GUICtrlRead($aInput[2][0]),1);-------->previous filled in old pass from GUI.
                Send("{enter}")
                ;BlockInput (0)  
        If WinActive("Lotus Notes") then EnterPassword()     ;Iff this window apears the pass filled in in the GUI was wrong so
                                                                     ;the user must put in his right pass en the script must go futher when
                                                                     ;the right pass is entered.But also change the ¨$Text¨ to $aInput[2][0].
                                                                     ;because iff the old pass is wrong here also in the next window....
        While not WinActive("User Security")   
            Sleep(10)    
        WEnd
        ;BlockInput (1)
        Send("!p")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)  ;<-------------------------------------like here :)
        Send("{enter}")
        BlockInput (0)
        WinWaitActive("Change Password")
        ;BlockInput (1)
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{TAB}")
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{enter}")
        While not WinActive("IBM Lotus Notes") 
            Sleep(10)   
        WEnd
        Send("{enter}")
        While not WinActive("User Security")
            Sleep(10)
        WEnd
        ;BlockInput (0)
    Else
        ;BlockInput (1)
        WinWaitClose("[CLASS:NOTES]", "")
        Run("C:\Program Files\lotus\notes\Notes.exe")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;************************************************same here........
        WinWaitActive("NVI Startpagina - IBM Lotus Notes")
        Send("{ALTDOWN}")
        Send("f")
        Send("y")
        Send("s")
        Send("{ALTUP}")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;************************************************and here
        ;BlockInput (0)
        WinWaitActive("User Security")
        ;BlockInput (1)
        Send("!p")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;************************************************also here :P
        ;BlockInput (0)
        WinWaitActive("Change Password")
        ;BlockInput (1)
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{TAB}")
        send(GUICtrlRead($aInput[0][0]),1)
        ;BlockInput (0)
    EndIf
Func EnterPassword()
   $Text=WinGetText("Lotus Notes","")   ;Get text from the password window from lotus notes
EndFunc

Can anyone help me whit this or push me in the right direction??????

mvg,

FMS

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can put make a function of ur gui and call it again when old password is wrong. Lotus notes will generate a window, saying old password is wrong.. U can see if that windows is generated.. If yes, then call ur gui function again.. and make user write in the password again!!

I am still not clear on what exactly you want since u haven't written things much clearly!! But if what I am suggesting doesn't answer ur question, please feel free to post again..

P.S. Bdw, why do u need a two dimensional array to store the passwords?

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

The reason i need 2 password fields u will c when u run this script.

it starts whit a GUI where u must put in your old passwords.

1 time filling in will generate more incorrect passes >_<

#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]="Novell"
$aArray[2]="Lotus Notes"
$aArray[3]="3"
$aArray[4]="4"

For $i = 1 To 4 step 1
        GUICtrlCreateGroup("Oud Wachtwoord", 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("Nieuwe wachtwoord", 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 of wachtwoorden niet hetzelfde zijn
                        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 $iRun
                            Call("PW_Change" & $i)
                        EndIf
                    EndIf
                Next
            Else
                MsgBox(0,"(MWC","Er is geen Checkbox aangevinkt" ,4)
            EndIf
        Case $Button1 ;Cancel
            Exit
        Case $GUI_EVENT_CLOSE ;kruisje
            Exit
    EndSwitch
WEnd

Func PW_Change1()
MsgBox(0, "MPC", "Uw wachtwoord van " & $aArray[1] & " word nu veranderd")
;QUICK password [<otype.=]<name*><pwd>[oldpwd]
;Examples
;QUICK password User=A* something
;QUICK password .someone.ou1.org something anything
;    BlockInput (1)

 ;   BlockInput (0)
EndFunc

Func PW_Change2()
Sleep(300)
    If ProcessExists("nlnotes.exe") Then
        ;**************************************By running application**************************************************
        ;BlockInput (1)
        Run("C:\Program Files\lotus\notes\Notes.exe")
        ;WinWaitActive("[CLASS:NOTES]", "")
        While not WinActive("[CLASS:NOTES]", "")   ;Stays in a loop until "User Security" active
            Sleep(10)    ;Sleep 10 ms, to reduce CPU speed when in a loop
        WEnd
        Send("{ALTDOWN}")
        Send("f")
        Send("y")
        Send("s")
        Send("{ALTUP}")
        While not WinActive("Lotus Notes")   
            Sleep(10)    
        WEnd
        send(GUICtrlRead($aInput[2][0]),1)
        If WinActive("Lotus Notes") then EnterPassword()     
        Send("{enter}")
                ;BlockInput (0)
        While not WinActive("User Security")   ;Stays in a loop until "User Security" active
            Sleep(10)    ;Sleep 10 ms, to reduce CPU speed when in a loop
            ;If WinActive("IBM Lotus Notes") then EnterPassword()     ;If "Lotus Notes" window active, the script will execute EnterPassword function
            ;Sleep(10)
            ;Send("{enter}")
        WEnd
        ;BlockInput (1)
        Send("!p")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;************************************************What iff Pass is incorrect
        ;BlockInput (0)
        WinWaitActive("Change Password")
        ;BlockInput (1)
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{TAB}")
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{enter}")
        While not WinActive("IBM Lotus Notes")  
            Sleep(10)    
        WEnd
        Send("{enter}")
        While not WinActive("User Security")
            Sleep(10)
        WEnd
        ;BlockInput (0)
    Else
        ;**************************************By NOT running application*****************************************
        ;BlockInput (1)
        WinWaitClose("[CLASS:NOTES]", "")
        Run("C:\Program Files\lotus\notes\Notes.exe")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        WinWaitActive("NVI Startpagina - IBM Lotus Notes")
        Send("{ALTDOWN}")
        Send("f")
        Send("y")
        Send("s")
        Send("{ALTUP}")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;BlockInput (0)
        WinWaitActive("User Security")
        ;BlockInput (1)
        Send("!p")
        WinWaitActive("Lotus Notes")
        send(GUICtrlRead($aInput[2][0]),1)
        Send("{enter}")
        ;BlockInput (0)
        WinWaitActive("Change Password")
        ;BlockInput (1)
        send(GUICtrlRead($aInput[0][0]),1)
        Send("{TAB}")
        send(GUICtrlRead($aInput[0][0]),1)
        ;BlockInput (0)
    EndIf

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 = 0
    Local $iDigits = 0
    Local $iSpecialChars = 0

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

EndFunc
Func EnterPassword()
   $Text=WinGetText("Lotus Notes","")   ;Get text from the password window from lotus notes
EndFunc

This is what i got this far.

maybe this whil answer your question :(

But i dont think i must call back mine GUI again because the user can fill it in himself....

The problem is,.....

what iff the user put in again a wrong password....????


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  
Followers 0