Sign in to follow this  
Followers 0
FMS

Must be the same inputs.

9 posts in this topic

#1 ·  Posted (edited)

Dear reader,

As the topic description says i m realy stuck in this one.

Also i must say i m a little new at this but want to learn how it all works...

Some basic´s i have under mine belt but stuck at this one so i hope someone can help me ...

This script is born out of the ID to have one GUI to change multiple programs the passwords from into 1 password for all(whish checkboxes are on)

This is what i got until now:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;*************************************************************************************************************
$Form2 = GUICreate("GUI create", 481, 472, 186, 112)
;*************************************************************************************************************
$Group1 = GUICtrlCreateGroup("Check", 16, 16, 193, 297)
$Checkbox1 = GUICtrlCreateCheckbox("Check1", 40, 48, 105, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Check2", 40, 112, 105, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Check3", 40, 176, 105, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Check4", 40, 240, 105, 17)
;*************************************************************************************************************
$Group2 = GUICtrlCreateGroup("Inputs", 232, 16, 225, 297)
$Input1 = GUICtrlCreateInput("Input1", 248, 40, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input2 = GUICtrlCreateInput("Input1", 248, 72, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input3 = GUICtrlCreateInput("Input2", 248, 104, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input4 = GUICtrlCreateInput("Input2", 248, 136, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input5 = GUICtrlCreateInput("Input3", 248, 168, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input6 = GUICtrlCreateInput("Input3", 248, 200, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input7 = GUICtrlCreateInput("Input4", 248, 232, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input8 = GUICtrlCreateInput("Input4", 248, 264, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
;*************************************************************************************************************
$Group3 = GUICtrlCreateGroup("Inputs", 16, 320, 441, 129)
$Input9 = GUICtrlCreateInput("Input5", 104, 336, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Input10 = GUICtrlCreateInput("Input5", 104, 368, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Button2 = GUICtrlCreateButton("OK", 232, 408, 97, 25, $WS_GROUP)
$Button1 = GUICtrlCreateButton("Cancel", 120, 408, 89, 25, $WS_GROUP)
;*************************************************************************************************************
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
;*************************************************************************************************************
While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $Button2
       If GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then
      MsgBox(0, "MPC", "Input 1 was wrong")
      EndIf
    Case $msg = $Button1
            MsgBox(0, "MPC", "You clicked cancel! Exiting...")
            ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "MPC", "You clicked CLOSE! Exiting...",2)
      ExitLoop
  EndSelect
WEnd

If u C this script i want to have all inputs grayd out until a checkbox is on.(1 checkbox for 2 inputs)and if one of the inputs is wrong a message will pop up and tells u which are wrong.

Iff all checkboxes that where on are check on errors whit the corresponding inputs and iff that´s ok then the script puts out all inputs(keyboard and mouse)and uses the keyboard shortcuts to change the old passwords for the one new one (input 9 and 10)from only whish checkboxes are one and passes are ok.

I tried many things for this ID but all where bogus:(

i hope someone can help me whit this or push me in the right direction.

thnx in advanced....

greets FMS out of holland

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites



FMS,

Have a look at this. Ask if anything is unclear:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;*************************************************************************************************************
$Form2 = GUICreate("Password Changer", 480, 480)
;*************************************************************************************************************
GUICtrlCreateGroup("Application 1 - Current PW", 10, 10, 460, 70)
$Checkbox1 = GUICtrlCreateCheckbox("Change PW", 20, 30, 100, 20)
$Input11 = GUICtrlCreateInput("", 150, 20, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input12 = GUICtrlCreateInput("", 150, 50, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 2 - Current PW", 10, 80, 460, 70)
$Checkbox2 = GUICtrlCreateCheckbox("Change PW", 20, 100, 100, 20)
$Input21 = GUICtrlCreateInput("", 150, 90, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input22 = GUICtrlCreateInput("", 150, 120, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 3 - Current PW", 10, 150, 460, 70)
$Checkbox3 = GUICtrlCreateCheckbox("Change PW", 20, 170, 100, 20)
$Input31 = GUICtrlCreateInput("", 150, 160, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input32 = GUICtrlCreateInput("", 150, 190, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 4 - Current PW", 10, 220, 460, 70)
$Checkbox4 = GUICtrlCreateCheckbox("Change PW", 20, 240, 100, 20)
$Input41 = GUICtrlCreateInput("", 150, 230, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input42 = GUICtrlCreateInput("", 150, 260, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

;*************************************************************************************************************
GUICtrlCreateGroup("New Password", 10, 320, 460, 130)
$Input1 = GUICtrlCreateInput("", 100, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input2 = GUICtrlCreateInput("", 100, 360, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Button2 = GUICtrlCreateButton("Change", 260, 400, 80, 30)
$Button1 = GUICtrlCreateButton("Cancel", 140, 400, 80, 30)
;*************************************************************************************************************
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
;*************************************************************************************************************
While 1

    Switch GUIGetMsg()
        Case $Button2
            If BitAnd(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input11) = "" Or GUICtrlRead($Input12) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 1")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input11) <> GUICtrlRead($Input12) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 1")
                    ContinueLoop
                EndIf
            EndIf
            If BitAnd(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input21) = "" Or GUICtrlRead($Input22) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 2")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input21) <> GUICtrlRead($Input22) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 2")
                    ContinueLoop
                EndIf
            EndIf
            If BitAnd(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input31) = "" Or GUICtrlRead($Input32) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 3")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input31) <> GUICtrlRead($Input32) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 3")
                    ContinueLoop
                EndIf
            EndIf
            If BitAnd(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input41) = "" Or GUICtrlRead($Input42) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 4")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input41) <> GUICtrlRead($Input42) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 4")
                    ContinueLoop
                EndIf
            EndIf
            If GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Then
                MsgBox(0, "MPC", "Missing New PW")
                ContinueLoop
            EndIf
            If GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then
                MsgBox(0, "MPC", "New PW Mismatch")
                ContinueLoop
            EndIf
            MsgBox(0, "MPC", "All PWs match! Changing...")
            ; PW changing code goes here
        Case $Button1
            MsgBox(0, "MPC", "You clicked cancel! Exiting...")
            Exit
        Case $GUI_EVENT_CLOSE
            MsgBox(0, "MPC", "You clicked CLOSE! Exiting...", 2)
            Exit
    EndSwitch
WEnd

M23

P.S. Please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here).


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

AAaaaa yesss just what i needed :)

i m very glad whit this one... its even a better lay out:)

thnx for that correction ;)

the only problem now is that... what iff there is no checkbox on?

or what iff not all checkboxes are on?

as u can C I m a newby @ this and learned enormes from your intervierence :)

i got the key strokes for eachs program but dont know

where 2 put it.can u help me whit that?


as finishing touch god created the dutch

Share this post


Link to post
Share on other sites

MS,

Apologies, I should have thought of the "No checks" case! I have put in a little flag to solve that:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;*************************************************************************************************************
$Form2 = GUICreate("Password Changer", 480, 480)
;*************************************************************************************************************
GUICtrlCreateGroup("Application 1 - Current PW", 10, 10, 460, 70)
$Checkbox1 = GUICtrlCreateCheckbox("Change PW", 20, 30, 100, 20)
$Input11 = GUICtrlCreateInput("", 150, 20, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input12 = GUICtrlCreateInput("", 150, 50, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 2 - Current PW", 10, 80, 460, 70)
$Checkbox2 = GUICtrlCreateCheckbox("Change PW", 20, 100, 100, 20)
$Input21 = GUICtrlCreateInput("", 150, 90, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input22 = GUICtrlCreateInput("", 150, 120, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 3 - Current PW", 10, 150, 460, 70)
$Checkbox3 = GUICtrlCreateCheckbox("Change PW", 20, 170, 100, 20)
$Input31 = GUICtrlCreateInput("", 150, 160, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input32 = GUICtrlCreateInput("", 150, 190, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 4 - Current PW", 10, 220, 460, 70)
$Checkbox4 = GUICtrlCreateCheckbox("Change PW", 20, 240, 100, 20)
$Input41 = GUICtrlCreateInput("", 150, 230, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input42 = GUICtrlCreateInput("", 150, 260, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

;*************************************************************************************************************
GUICtrlCreateGroup("New Password", 10, 320, 460, 130)
$Input1 = GUICtrlCreateInput("", 100, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input2 = GUICtrlCreateInput("", 100, 360, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Button2 = GUICtrlCreateButton("Change", 260, 400, 80, 30)
$Button1 = GUICtrlCreateButton("Cancel", 140, 400, 80, 30)
;*************************************************************************************************************
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
;*************************************************************************************************************

$iCheckCount = 0

While 1

    Switch GUIGetMsg()
        Case $Button2
            If BitAnd(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input11) = "" Or GUICtrlRead($Input12) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 1")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input11) <> GUICtrlRead($Input12) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 1")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input21) = "" Or GUICtrlRead($Input22) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 2")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input21) <> GUICtrlRead($Input22) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 2")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input31) = "" Or GUICtrlRead($Input32) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 3")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input31) <> GUICtrlRead($Input32) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 3")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input41) = "" Or GUICtrlRead($Input42) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 4")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input41) <> GUICtrlRead($Input42) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 4")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Then
                MsgBox(0, "MPC", "Missing New PW")
                ContinueLoop
            EndIf
            If GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then
                MsgBox(0, "MPC", "New PW Mismatch")
                ContinueLoop
            EndIf
            If $iCheckCount Then
                MsgBox(0, "MPC", "All PWs match! Changing...")
                ; PW changing code goes here  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            Else
                MsgBox(0, "MPC", "No Applications selected!")
            EndIf
        Case $Button1
            MsgBox(0, "MPC", "You clicked cancel! Exiting...")
            Exit
        Case $GUI_EVENT_CLOSE
            MsgBox(0, "MPC", "You clicked CLOSE! Exiting...", 2)
            Exit
    EndSwitch
WEnd

The place to put your keystroke commands was already marked, but I have added lots of <<<<<<<<<<<<<<<<<< to highlight it! :-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

thnx for the all checkbox off switch :)

and indeed i saw where u put where i must put in the code...

but,...

i ment that:

what iff checkbox 1 is checked 2 not and 3 is checked and 4 not....???

so iff the checkbox is checked play the code for that checknbox and for the rest not...

Is it also possible to make a error message iff there is something villed in in the input fields

but the checkbox isn´t checked????

do you know how to put that in????

i hope i dont be a batther you whit this...

thnx in advanced(again)

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites

FMS,

Here you go:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;*************************************************************************************************************
$Form2 = GUICreate("Password Changer", 480, 480)
;*************************************************************************************************************
GUICtrlCreateGroup("Application 1 - Current PW", 10, 10, 460, 70)
$Checkbox1 = GUICtrlCreateCheckbox("Change PW", 20, 30, 100, 20)
$Input11 = GUICtrlCreateInput("", 150, 20, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input12 = GUICtrlCreateInput("", 150, 50, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 2 - Current PW", 10, 80, 460, 70)
$Checkbox2 = GUICtrlCreateCheckbox("Change PW", 20, 100, 100, 20)
$Input21 = GUICtrlCreateInput("", 150, 90, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input22 = GUICtrlCreateInput("", 150, 120, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 3 - Current PW", 10, 150, 460, 70)
$Checkbox3 = GUICtrlCreateCheckbox("Change PW", 20, 170, 100, 20)
$Input31 = GUICtrlCreateInput("", 150, 160, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input32 = GUICtrlCreateInput("", 150, 190, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

GUICtrlCreateGroup("Application 4 - Current PW", 10, 220, 460, 70)
$Checkbox4 = GUICtrlCreateCheckbox("Change PW", 20, 240, 100, 20)
$Input41 = GUICtrlCreateInput("", 150, 230, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input42 = GUICtrlCreateInput("", 150, 260, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

;*************************************************************************************************************
GUICtrlCreateGroup("New Password", 10, 320, 460, 130)
$Input1 = GUICtrlCreateInput("", 100, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Input2 = GUICtrlCreateInput("", 100, 360, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$Button2 = GUICtrlCreateButton("Change", 260, 400, 80, 30)
$Button1 = GUICtrlCreateButton("Cancel", 140, 400, 80, 30)
;*************************************************************************************************************
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
;*************************************************************************************************************

$iCheckCount = 0

While 1

    Switch GUIGetMsg()
        Case $Button2
            If BitAnd(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input11) = "" Or GUICtrlRead($Input12) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 1")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input11) <> GUICtrlRead($Input12) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 1")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input21) = "" Or GUICtrlRead($Input22) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 2")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input21) <> GUICtrlRead($Input22) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 2")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input31) = "" Or GUICtrlRead($Input32) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 3")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input31) <> GUICtrlRead($Input32) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 3")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If BitAnd(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
                If GUICtrlRead($Input41) = "" Or GUICtrlRead($Input42) = "" Then
                    MsgBox(0, "MPC", "Missing PW Application 4")
                    ContinueLoop
                EndIf
                If GUICtrlRead($Input41) <> GUICtrlRead($Input42) Then
                    MsgBox(0, "MPC", "PW Mismatch Application 4")
                    ContinueLoop
                EndIf
                $iCheckCount = 1
            EndIf
            If GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Then
                MsgBox(0, "MPC", "Missing New PW")
                ContinueLoop
            EndIf
            If GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then
                MsgBox(0, "MPC", "New PW Mismatch")
                ContinueLoop
            EndIf
            If $iCheckCount Then
                MsgBox(0, "MPC", "All PWs match! Changing...")
                If BitAnd(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                    MsgBox(0, "MPC", "Changing App 1")
                    ; PW changing code for app 1 goes here
                EndIf
                If BitAnd(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                    MsgBox(0, "MPC", "Changing App 2")
                    ; PW changing code for app 2 goes here
                EndIf
                If BitAnd(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                    MsgBox(0, "MPC", "Changing App 3")
                    ; PW changing code for app 3 goes here
                EndIf
                If BitAnd(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
                    MsgBox(0, "MPC", "Changing App 4")
                    ; PW changing code for app 4 goes here
                EndIf
            Else
                MsgBox(0, "MPC", "No Applications selected!")
            EndIf
        Case $Button1
            MsgBox(0, "MPC", "You clicked cancel! Exiting...")
            Exit
        Case $GUI_EVENT_CLOSE
            MsgBox(0, "MPC", "You clicked CLOSE! Exiting...", 2)
            Exit
    EndSwitch
WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

YESSSSSSSSS YOU´R THE GREATEST :)

many thank U´s are comming your way..... :)

but how the hell did u do this so fast ;)

all the work i did i did in many hours :S

(yeah i m new at this i know :P )

And in your case ¨it looks like¨

u generate this in seconds ;)

do i something wrong??? :P

i push F1 many times lol :P

doesn´t matther i learn from this a lot trust me :P

do u have another program to assist u whit this sort of problems?

is it possible to have restrictions for the new password???

i mean like:

must have 2 numbers and 1 strange charecter?

And new password can not be the same as old and the diffrence must be at least 2 charecters????

I hope i don´t ask 2 many :S

greets from someone who

is very thankfull for your work :P

signed

FMS

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

FMS,

OK, last bit of help for a while. This is a greatly modified version of your original code using arrays and loops to do repetitive tasks. It also checks the new password for a minimum length and inclusion of 2 digits and 1 special character (credit to mdiesel for that function!):

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

Global $aCheckbox[5]
Global $aInput[5][2]

$hGUI = GUICreate("Password Changer", 480, 480)

For $i = 1 To 4
    GUICtrlCreateGroup("Application " & $i & " - Current PW", 10, (70 * $i) - 60, 460, 70)
    $aCheckbox[$i] = GUICtrlCreateCheckbox("Change PW", 20, (70 * $i) - 40, 100, 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 Password", 10, 320, 460, 130)
$aInput[0][0] = GUICtrlCreateInput("", 100, 330, 300, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$aInput[0][1] = GUICtrlCreateInput("", 100, 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
            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, "MPC", "Missing PW Application " & $i)
                        ContinueLoop 2
                    EndIf
                    If GUICtrlRead($aInput[$i][0]) <> GUICtrlRead($aInput[$i][1]) Then
                        MsgBox(0, "MPC", "PW Mismatch Application " & $i)
                        ContinueLoop 2
                    EndIf
                    $iCheckCount = 1
                EndIf
            Next
            If GUICtrlRead($aInput[0][0]) = "" Or GUICtrlRead($aInput[0][1]) = "" Then
                MsgBox(0, "MPC", "Missing New PW")
                ContinueLoop
            EndIf
            If GUICtrlRead($aInput[0][0]) <> GUICtrlRead($aInput[0][1]) Then
                MsgBox(0, "MPC", "New PW Mismatch")
                ContinueLoop
            EndIf
            If Check_PW() = 0 Then
                MsgBox(0, "MPC", "New PW is not valid" & @CRLF & @CRLF & "PW must be min 7 chars with min 2 digits" & @CRLF & "and min 1 special char")
                GUICtrlSetData($aInput[0][0], "")
                GUICtrlSetData($aInput[0][1], "")
                ContinueLoop
            EndIf
            If $iCheckCount Then
                MsgBox(0, "MPC", "All PWs match! Changing...")
                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, "MPC", "No Applications selected!")
            EndIf
        Case $Button1
            ;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", "Changing App 1")
    ; Code for App 1 goes here
EndFunc

Func PW_Change2()
    MsgBox(0, "MPC", "Changing App 2")
    ; Code for App 2 goes here
EndFunc

Func PW_Change3()
    MsgBox(0, "MPC", "Changing App 3")
    ; Code for App 3 goes here
EndFunc

Func PW_Change4()
    MsgBox(0, "MPC", "Changing App 4")
    ; Code for App 4 goes here
EndFunc

Func Check_PW()
    ; credit to mdiesel

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

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

EndFunc

You wanted to learn - well this is how you do it: study this code and see if you can work out what is going on! One exception: do NOT try to understand the password checking code. RegEx is far too complicated - I am having great diffculty understanding the code myself and I am very glad I could find an example on the forums (thanks again mdiesel).

As I mentioned, I used arrays and loops. These are basic tools for any programmer and so you need to be able to deal with them. Look at the tutorial on arrays in the Wiki - it is very good ( http://www.autoitscript.com/wiki/index.php?title=Arrays )

You should also learn to use the Search facility - there are so many examples in these forums to learn from, such as the password checker function. ;-)

And that is how you learn AutoIt - or any other programming language - look at examples and play with them until you understand what they do, and more importantly why they work! The forums are here when you get stuck.

Do not give up too easily - your initial script was perfectly correct. Just try and improve as you go along.

Good luck,

M23

Edit: Speeling ;-)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hello Melba 32 (and mdiesel;))

again mine respect is great and the puzzel pieces are comming together.

Last night i have treid to understand the password restrictions....

And you are right ... lol ... very complicated but in a sence understandeble.

even so with arrays and loops.....

now when i c them working it's more understanble.

The greatest tip i think is that link to wiki...

WHY DIN'T I THINK OF THAT...... lol

you have opend mine eyes;)

thank you so far.

there are comming again many thank U's your way :)

Greez FMS


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