Jump to content

Arrays and complications of them


Mintz
 Share

Recommended Posts

CODE
$Input1 = GUICtrlCreateCombo("Pick One", 10, 10, 100)

$Input2 = GUictrlcreateCombo("Pick One", 10, 40, 100)

$Input3 = GUictrlcreateCombo("Pick One", 10, 70, 100)

$Input4 = GUictrlcreateCombo("Pick One", 10, 100, 100)

$Input5 = GUictrlcreateCombo("Pick One", 10, 130, 100)

$Edit1 = GUICtrlCreateEdit("Info", 120, 10, 100, 35)

$Edit2 = GUICtrlCreateEdit("Info", 120, 40, 100, 35)

$Edit3 = GUICtrlCreateEdit("Info", 120, 70, 100, 35)

$Edit4 = GUICtrlCreateEdit("Info", 120, 100, 100, 35)

$Edit5 = GUICtrlCreateEdit("Info", 120, 130, 100, 35)

$GO = GUICtrlCreateButton("GO!", 50, 160, 60)

GUICtrlSetData($Input1, "Common|Differance|Support|Explination")

GUICtrlSetData($Input2, "Common|Differance|Support|Explination")

GUICtrlSetData($Input3, "Common|Differance|Support|Explination")

GUICtrlSetData($Input4, "Common|Differance|Support|Explination")

GUICtrlSetData($Input5, "Common|Differance|Support|Explination")

$output = _ArrayCreate(GUictrlread($Input1&" "&$edit1), GUictrlread($Input2&" "&$edit2), GUictrlread($Input3&" "&$edit3), GUictrlread($Input4&" "&$edit4), GUictrlread($Input5&" "&$edit5))

$check1a = StringRegExp($Output[1], "Common")

$check2a = StringRegExp($Output[2], "Common")

$check3a = StringRegExp($Output[3], "Common")

$check4a = StringRegExp($Output[4], "Common")

$check5a = StringRegExp($Output[5], "Common")

$check1b = StringRegExp($Output[1], "Differance")

$check2b = StringRegExp($Output[2], "Differance")

$check3b = StringRegExp($Output[3], "Differance")

$check4b = StringRegExp($Output[4], "Differance")

$check5b = StringRegExp($Output[5], "Differance")

$check1c = StringRegExp($Output[1], "Support")

$check2c = StringRegExp($Output[2], "Support")

$check3c = StringRegExp($Output[3], "Support")

$check4c = StringRegExp($Output[4], "Support")

$check5c = StringRegExp($Output[5], "Support")

$check1d = StringRegExp($Output[1], "Explination")

$check2d = StringRegExp($Output[2], "Explination")

$check3d = StringRegExp($Output[3], "Explination")

$check4d = StringRegExp($Output[4], "Explination")

$check5d = StringRegExp($Output[5], "Explination")

I Guess this is not so much an array question, but i have a hunch it can be sloved w/ one... anyway, i have that up there, and i need all of thoes $check1a s that return 1 to be used, and those that return 0 to be ignored, is it possible to do that w/o having to write up a huge select statement?

Link to comment
Share on other sites

hum the array size was wrong... maybe this-

#include <array.au3>
$gui=GUICreate("")
GUISetOnEvent(-3,"AnExit")
Opt("GUIOnEventMode",1)
$Input1 = GUICtrlCreateCombo("Pick One", 10, 10, 100)
$Input2 = GUictrlcreateCombo("Pick One", 10, 40, 100)
$Input3 = GUictrlcreateCombo("Pick One", 10, 70, 100)
$Input4 = GUictrlcreateCombo("Pick One", 10, 100, 100)
$Input5 = GUictrlcreateCombo("Pick One", 10, 130, 100)
$Edit1 = GUICtrlCreateEdit("Info", 120, 10, 100, 35)
$Edit2 = GUICtrlCreateEdit("Info", 120, 40, 100, 35)
$Edit3 = GUICtrlCreateEdit("Info", 120, 70, 100, 35)
$Edit4 = GUICtrlCreateEdit("Info", 120, 100, 100, 35)
$Edit5 = GUICtrlCreateEdit("Info", 120, 130, 100, 35)
$GO = GUICtrlCreateButton("GO!", 50, 160, 60)
GUICtrlSetData($Input1, "Common|Differance|Support|Explination")
GUICtrlSetData($Input2, "Common|Differance|Support|Explination")
GUICtrlSetData($Input3, "Common|Differance|Support|Explination")
GUICtrlSetData($Input4, "Common|Differance|Support|Explination")
GUICtrlSetData($Input5, "Common|Differance|Support|Explination")

$output = _ArrayCreate(GUictrlread($Input1&" "&$edit1), GUictrlread($Input2&" "&$edit2), GUictrlread($Input3&" "&$edit3), GUictrlread($Input4&" "&$edit4), GUictrlread($Input5&" "&$edit5))
$check1a = StringRegExp($Output[0], "Common")
$check2a = StringRegExp($Output[1], "Common")
$check3a = StringRegExp($Output[2], "Common")
$check4a = StringRegExp($Output[3], "Common")
$check5a = StringRegExp($Output[4], "Common")

$check1b = StringRegExp($Output[0], "Differance")
$check2b = StringRegExp($Output[1], "Differance")
$check3b = StringRegExp($Output[2], "Differance")
$check4b = StringRegExp($Output[3], "Differance")
$check5b = StringRegExp($Output[4], "Differance")

$check1c = StringRegExp($Output[0], "Support")
$check2c = StringRegExp($Output[1], "Support")
$check3c = StringRegExp($Output[2], "Support")
$check4c = StringRegExp($Output[3], "Support")
$check5c = StringRegExp($Output[4], "Support")

$check1d = StringRegExp($Output[0], "Explination")
$check2d = StringRegExp($Output[1], "Explination")
$check3d = StringRegExp($Output[2], "Explination")
$check4d = StringRegExp($Output[3], "Explination")
$check5d = StringRegExp($Output[4], "Explination")
GUISetState(@SW_SHOW)
while 1
    Sleep(100)
WEnd
func AnExit()
    Exit
EndFunc
Link to comment
Share on other sites

A little more advanced, but a working script

#include <GUIConstants.au3>
#include <_ControlHover.au3>

Dim $Input[6], $Edit[6], $iRead[6], $eRead[6], $output


Dim $SetInfo = "Common|Differance|Support|Explination"
Dim $Info = StringSplit($SetInfo, "|")


$mygui = GuiCreate("DEMO", 280, 200)

$Input[1] = GUICtrlCreateCombo("Pick One", 10, 10, 100)
$Input[2] = GUictrlcreateCombo("Pick One", 10, 40, 100)
$Input[3] = GUictrlcreateCombo("Pick One", 10, 70, 100)
$Input[4] = GUictrlcreateCombo("Pick One", 10, 100, 100)
$Input[5] = GUictrlcreateCombo("Pick One", 10, 130, 100)
$Edit[1] = GUICtrlCreateEdit("Info", 120, 10, 100, 35)
$Edit[2] = GUICtrlCreateEdit("Info", 120, 40, 100, 35)
$Edit[3] = GUICtrlCreateEdit("Info", 120, 70, 100, 35)
$Edit[4] = GUICtrlCreateEdit("Info", 120, 100, 100, 35)
$Edit[5] = GUICtrlCreateEdit("Info", 120, 130, 100, 35)
$GO = GUICtrlCreateButton("GO!", 50, 160, 60)

for $x = 1 to UBound($Input) -1
    GUICtrlSetData($Input[$x], $SetInfo)
Next

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $GO
            For $x = 1 to UBound($Input) -1
                $iRead[$x] = GUICtrlRead($Input[$x])
                $eRead[$x] = GUICtrlRead($Edit[$x])
                for $i = 1 to UBound($Info) -1
                    If $iRead[$x] = $Info[$i] Then
                        Do_My_Function( $x, $i)
                        $output = $output & $iRead[$x] & ": " & @CRLF & $eRead[$x] & @CRLF & @CRLF 
                    EndIf
                Next
                If $x = UBound($Input) -1 Then MsgBox(0x0, "all Info", $output)
            Next
    EndSwitch
    
WEnd

Func Do_My_Function( $xX, $iI)
    MsgBox(0x0,  $iRead[$xX] & ": ", $eRead[$xX], 2)
EndFunc

8)

NEWHeader1.png

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