Jump to content

Must be the same input?


Recommended Posts

Dear reader,

Does anyone know how i can make:

in the input fields--> input field 1 and 2 must be the same otherwise u get a error messags and goes back?

the same whit input field 3 and 4 .... and so on...

i tried multiple things but all was bogus :)

thnx in advanced :)

can anyone help me?

(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 control", 481, 472, 186, 112)

$Input1 = GUICtrlCreateInput("Input1", 248, 40, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Checkbox1 = GUICtrlCreateCheckbox("prog 1", 40, 48, 105, 17)

$Input2 = GUICtrlCreateInput("Input2", 248, 72, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Checkbox2 = GUICtrlCreateCheckbox("Prog 2", 40, 112, 105, 17)

$Input3 = GUICtrlCreateInput("Input3", 248, 104, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Input4 = GUICtrlCreateInput("Input4", 248, 136, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Checkbox3 = GUICtrlCreateCheckbox("Prog 3", 40, 176, 105, 17)

$Input5 = GUICtrlCreateInput("Input5", 248, 168, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Input6 = GUICtrlCreateInput("Input6", 248, 200, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Checkbox4 = GUICtrlCreateCheckbox("Prog 4", 40, 240, 105, 17)

$Input7 = GUICtrlCreateInput("Input7", 248, 232, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Input8 = GUICtrlCreateInput("Input8", 248, 264, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Input9 = GUICtrlCreateInput("Input9", 104, 336, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Button1 = GUICtrlCreateButton("OK", 232, 408, 97, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Cancel", 120, 408, 89, 25, $WS_GROUP)

$Group1 = GUICtrlCreateGroup("Group 1", 16, 16, 193, 297)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Group 2", 232, 16, 225, 297)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Input10 = GUICtrlCreateInput("Input10", 104, 368, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Group3 = GUICtrlCreateGroup("Group 3", 16, 320, 441, 129)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

as finishing touch god created the dutch

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $cnt = 0, $cnt2 = 0, $Input[9], $Checkbox[5]
$Form2 = GUICreate("GUI control", 481, 472, 186, 112)
For $i = 40 To 264 step 32
    $cnt +=1
    $Input[$cnt] = GUICtrlCreateInput("Input1", 248, $i, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
Next
For $i = 60 To 240 step 60
$Checkbox[$cnt2] = GUICtrlCreateCheckbox("prog 1", 40, $i, 105, 17)
Next
$Input9 = GUICtrlCreateInput("Input9", 104, 336, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("OK", 232, 408, 97, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Cancel", 120, 408, 89, 25, $WS_GROUP)
$Group1 = GUICtrlCreateGroup("Group 1", 16, 16, 193, 297)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group 2", 232, 16, 225, 297)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input10 = GUICtrlCreateInput("Input10", 104, 368, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Group3 = GUICtrlCreateGroup("Group 3", 16, 320, 441, 129)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
        For $i = 1 to 8 Step 2
            If GUICtrlRead($Input[$i]) <> GUICtrlRead($Input[$i+1]) Then
                GUICtrlSetData($Input[$i],"")
                GUICtrlSetData($Input[$i+1],"")
            EndIf
            Next

EndSwitch
WEnd

_____________________________________________________________________________

Link to comment
Share on other sites

Great script and i can use some things in it...

thnx u that :)

but it wasn´t what i had in mind....

this way only the text disapears but u don´t get a error message and the answers in the input fields are +1 ...

I want to have them exacly the same otherwise an error message when pressed OK.

so input field 1 and 2 must be the same iff the checkbox 1 is on....

and 3 and 4 must be the same if the checkbox 2 is on...

and 5 and 6 must be the same if the checkbox 3 is on...

(sorry i am a little new at autoit maybe is this a little noobish) :)

Edited by FMS

as finishing touch god created the dutch

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $cnt = 0, $cnt2 = 0, $Input[9], $Checkbox[5], $err = 0
$Form2 = GUICreate("GUI control", 481, 472, 186, 112)
For $i = 40 To 264 step 32
    $cnt +=1
    $Input[$cnt] = GUICtrlCreateInput("Input1", 248, $i, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
Next
For $i = 60 To 240 step 60
$Checkbox[$cnt2] = GUICtrlCreateCheckbox("prog 1", 40, $i, 105, 17)
$cnt2+=1
Next
$Input9 = GUICtrlCreateInput("Input9", 104, 336, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("OK", 232, 408, 97, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Cancel", 120, 408, 89, 25, $WS_GROUP)
$Group1 = GUICtrlCreateGroup("Group 1", 16, 16, 193, 297)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group 2", 232, 16, 225, 297)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input10 = GUICtrlCreateInput("Input10", 104, 368, 241, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Group3 = GUICtrlCreateGroup("Group 3", 16, 320, 441, 129)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
Case $Button1
    $err = 0
        $number = 0
        For $i = 1 to 8 Step 2
            If GUICtrlRead($Input[$i]) <> GUICtrlRead($Input[$i+1]) And (GUICtrlRead($Input[$i]) <> "" Or GUICtrlRead($Input[$i+1]) <> "") And GUICtrlRead($Checkbox[$number])=1 Then
                GUICtrlSetData($Input[$i],"")
                GUICtrlSetData($Input[$i+1],"")
                $err = 1
            EndIf
            $number +=1
        Next
        If $err = 1 Then
            MsgBox(0,"Error!","Enter correct passwords and try again!")
        EndIf
EndSwitch
WEnd

_____________________________________________________________________________

Link to comment
Share on other sites

thnx a lot ;)

this was just what i needed :)

how the hel did u generated this fast :)

is there a easyer way ?

whit greatest respect ;) ,

FMS

Edited by FMS

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