Ausgeben zufälliger Variablen Paare

  • so ich hab mal wieder ein kleines/großes Problem

    und zwar hab ich ein paar verschiedene variablen Paare und die will ich jetzt zufällig ausgeben lassen

    Spoiler anzeigen
    [autoit]

    HotKeySet ( "{ESC}", "End" )

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    Opt( "GUIOnEventMode", 1 )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Fenster = GUICreate ( "Koordinaten", 200, 200 )
    GUICtrlCreateLabel ( "Bitte geben sie 3 Zahlenpaare ein.", 25, 15 )
    $Feld1 = GUICtrlCreateInput ( "", 65, 55, 30 )
    $Feld2 = GUICtrlCreateInput ( "", 100, 55 )
    $Feld3 = GUICtrlCreateInput ( "", 65, 80, 30 )
    $Feld4 = GUICtrlCreateInput ( "", 100, 80 )
    $Feld5 = GUICtrlCreateInput ( "", 65, 105, 30 )
    $Feld6 = GUICtrlCreateInput ( "", 100, 105 )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $okbutton = GUICtrlCreateButton ( "OK", 70, 160, 60 )
    GUICtrlSetOnEvent($okbutton, "OKButton")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState ( @SW_Show )

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(1000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func OKButton()
    $1 = GUICtrlRead ( $Feld1 )
    $2 = GUICtrlRead ( $Feld2 )
    $3 = GUICtrlRead ( $Feld3 )
    $4 = GUICtrlRead ( $Feld4 )
    $5 = GUICtrlRead ( $Feld5 )
    $6 = GUICtrlRead ( $Feld6 )
    GUIDelete ( $Fenster )
    MsgBox ( 1, "" , "Eines ihrer Zahlenpaare ist: " )
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func End()
    Exit
    EndFunc

    [/autoit]

    variablen Paare währen hier zum Beispiel $1 und $2 bzw $5 und $6

    Einmal editiert, zuletzt von Jojo the big (1. Juni 2009 um 01:33)

  • Hallo Jojo the big,

    am besten nimmst du dafür Random z.B. so:

    Spoiler anzeigen
    [autoit]

    HotKeySet ( "{ESC}", "End" )

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    Opt( "GUIOnEventMode", 1 )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Fenster = GUICreate ( "Koordinaten", 200, 200 )
    GUICtrlCreateLabel ( "Bitte geben sie 3 Zahlenpaare ein.", 25, 15 )
    $Feld1 = GUICtrlCreateInput ( "", 65, 55, 30 )
    $Feld2 = GUICtrlCreateInput ( "", 100, 55 )
    $Feld3 = GUICtrlCreateInput ( "", 65, 80, 30 )
    $Feld4 = GUICtrlCreateInput ( "", 100, 80 )
    $Feld5 = GUICtrlCreateInput ( "", 65, 105, 30 )
    $Feld6 = GUICtrlCreateInput ( "", 100, 105 )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $okbutton = GUICtrlCreateButton ( "OK", 70, 160, 60 )
    GUICtrlSetOnEvent($okbutton, "OKButton")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState ( @SW_Show )

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(1000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func OKButton()
    $1 = GUICtrlRead ( $Feld1 )
    $2 = GUICtrlRead ( $Feld2 )
    $3 = GUICtrlRead ( $Feld3 )
    $4 = GUICtrlRead ( $Feld4 )
    $5 = GUICtrlRead ( $Feld5 )
    $6 = GUICtrlRead ( $Feld6 )
    GUIDelete ( $Fenster )
    $iWahl = Random(1,3,1)
    Switch $iWahl
    case 1
    $sErg =$1 & " | " & $2
    case 2
    $sErg =$3 & " | " & $4
    case 3
    $sErg =$5 & " | " & $6
    EndSwitch
    MsgBox ( 1, "" , "Eines ihrer Zahlenpaare ist: " & $sErg)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func End()
    Exit
    EndFunc

    [/autoit]


    viel Spaß damit,

    mfg (Auto)Bert