(anfänger)Skript kürzen? tipps?

  • hallo liebe comunity,

    habe gestern schon mal ein problem gepostet (HIER) und habe sehr hilfreiche antworten bekommen!! (nochmals danke)

    nun habe ich mein ziel fast erreicht welches ich bei diesem skript haben wollte. es funktioniert so wie es soll.

    nur allerdings finde ich das es vielleicht einfach zuviel sinnlosen (zulangen) code gibt und möchte deswegen von euch gerne eine meinung bzw. ein lösungsvorschlag.

    hier der code:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    $text1 = Random(1, 9, 1)
    $text2 = Random(1, 9, 1)
    If $text1 = $text2 Then
    While 1
    $text2 = Random(1, 9, 1)
    If $text1 <> $text2 Then ExitLoop
    WEnd
    EndIf
    $text3 = random(1, 9, 1)
    If $text3 = $text1 Or $text3 = $text2 Then
    While 1
    $text3 = Random (1, 9, 1)
    If $text3 <> $text1 And $text3 <> $text2 Then ExitLoop
    WEnd
    EndIf
    $text4 = random(1, 9, 1)
    If $text4 = $text1 Or $text4 = $text2 Or $text4 = $text3 Then
    While 1
    $text4 = Random (1, 9, 1)
    If $text4 <> $text1 And $text4 <> $text2 And $text4 <> $text3 Then ExitLoop
    WEnd
    EndIf
    $text5 = random(1, 9, 1)
    If $text5 = $text1 Or $text5 = $text2 Or $text5 = $text3 Or $text5 = $text4 Then
    While 1
    $text5 = Random (1, 9, 1)
    If $text5 <> $text1 And $text5 <> $text2 And $text5 <> $text3 And $text5 <> $text4 Then ExitLoop
    WEnd
    EndIf
    $text6 = random(1, 9, 1)
    If $text6 = $text1 Or $text6 = $text2 Or $text6 = $text3 Or $text6 = $text4 Or $text6 = $text5 Then
    While 1
    $text6 = Random (1, 9, 1)
    If $text6 <> $text1 And $text6 <> $text2 And $text6 <> $text3 And $text6 <> $text4 And $text6 <> $text5 Then ExitLoop
    WEnd
    EndIf
    $text7 = random(1, 9, 1)
    If $text7 = $text1 Or $text7 = $text2 Or $text7 = $text3 Or $text7 = $text4 Or $text7 = $text5 Or $text7 = $text6 Then
    While 1
    $text7 = Random (1, 9, 1)
    If $text7 <> $text1 And $text7 <> $text2 And $text7 <> $text3 And $text7 <> $text4 And $text7 <> $text5 And $text7 <> $text6 Then ExitLoop
    WEnd
    EndIf
    $text8 = random(1, 9, 1)
    If $text8 = $text1 Or $text8 = $text2 Or $text8 = $text3 Or $text8 = $text4 Or $text8 = $text5 Or $text8 = $text6 Or $text8 = $text7 Then
    While 1
    $text8 = Random (1, 9, 1)
    If $text8 <> $text1 And $text8 <> $text2 And $text8 <> $text3 And $text8 <> $text4 And $text8 <> $text5 And $text8 <> $text6 And $text8 <> $text7 Then ExitLoop
    WEnd
    EndIf
    $text9 = random(1, 9, 1)
    If $text9 = $text1 Or $text9 = $text2 Or $text9 = $text3 Or $text9 = $text4 Or $text9 = $text5 Or $text9 = $text6 Or $text9 = $text7 Or $text9 = $text8 Then
    While 1
    $text9 = Random (1, 9, 1)
    If $text9 <> $text1 And $text9 <> $text2 And $text9 <> $text3 And $text9 <> $text4 And $text9 <> $text5 And $text9 <> $text6 And $text9 <> $text7 And $text9 <> $text8 Then ExitLoop
    WEnd
    EndIf
    $text10 = Random(1, 9, 1)
    $text20 = Random(1, 9, 1)
    If $text10 = $text20 Then
    While 1
    $text20 = Random(1, 9, 1)
    If $text10 <> $text20 Then ExitLoop
    WEnd
    EndIf
    $text30 = random(1, 9, 1)
    If $text30 = $text10 Or $text30 = $text20 Then
    While 1
    $text30 = Random (1, 9, 1)
    If $text30 <> $text10 And $text30 <> $text20 Then ExitLoop
    WEnd
    EndIf
    $text40 = random(1, 9, 1)
    If $text40 = $text10 Or $text40 = $text20 Or $text40 = $text30 Then
    While 1
    $text40 = Random (1, 9, 1)
    If $text40 <> $text10 And $text40 <> $text20 And $text40 <> $text30 Then ExitLoop
    WEnd
    EndIf
    $text50 = random(1, 9, 1)
    If $text50 = $text10 Or $text50 = $text20 Or $text50 = $text30 Or $text50 = $text40 Then
    While 1
    $text50 = Random (1, 9, 1)
    If $text50 <> $text10 And $text50 <> $text20 And $text50 <> $text30 And $text50 <> $text40 Then ExitLoop
    WEnd
    EndIf
    $text60 = random(1, 9, 1)
    If $text60 = $text10 Or $text60 = $text20 Or $text60 = $text30 Or $text60 = $text40 Or $text60 = $text50 Then
    While 1
    $text60 = Random (1, 9, 1)
    If $text60 <> $text10 And $text60 <> $text20 And $text60 <> $text30 And $text60 <> $text40 And $text60 <> $text50 Then ExitLoop
    WEnd
    EndIf
    $text70 = random(1, 9, 1)
    If $text70 = $text10 Or $text70 = $text20 Or $text70 = $text30 Or $text70 = $text40 Or $text70 = $text50 Or $text70 = $text60 Then
    While 1
    $text70 = Random (1, 9, 1)
    If $text70 <> $text10 And $text70 <> $text20 And $text70 <> $text30 And $text70 <> $text40 And $text70 <> $text50 And $text70 <> $text60 Then ExitLoop
    WEnd
    EndIf
    $text80 = random(1, 9, 1)
    If $text80 = $text10 Or $text80 = $text20 Or $text80 = $text30 Or $text80 = $text40 Or $text80 = $text50 Or $text80 = $text60 Or $text80 = $text70 Then
    While 1
    $text80 = Random (1, 9, 1)
    If $text80 <> $text10 And $text80 <> $text20 And $text80 <> $text30 And $text80 <> $text40 And $text80 <> $text50 And $text80 <> $text60 And $text80 <> $text70 Then ExitLoop
    WEnd
    EndIf
    $text90 = random(1, 9, 1)
    If $text90 = $text10 Or $text90 = $text20 Or $text90 = $text30 Or $text90 = $text40 Or $text90 = $text50 Or $text90 = $text60 Or $text90 = $text70 Or $text90 = $text80 Then
    While 1
    $text90 = Random (1, 9, 1)
    If $text90 <> $text10 And $text90 <> $text20 And $text90 <> $text30 And $text90 <> $text40 And $text90 <> $text50 And $text90 <> $text60 And $text90 <> $text70 And $text90 <> $text80 Then ExitLoop
    WEnd
    EndIf
    $text100 = Random(1, 9, 1)
    $text200 = Random(1, 9, 1)
    If $text100 = $text200 Then
    While 1
    $text200 = Random(1, 9, 1)
    If $text100 <> $text200 Then ExitLoop
    WEnd
    EndIf
    $text300 = random(1, 9, 1)
    If $text300 = $text100 Or $text300 = $text200 Then
    While 1
    $text300 = Random (1, 9, 1)
    If $text300 <> $text100 And $text300 <> $text200 Then ExitLoop
    WEnd
    EndIf
    $text400 = random(1, 9, 1)
    If $text400 = $text100 Or $text400 = $text200 Or $text400 = $text300 Then
    While 1
    $text400 = Random (1, 9, 1)
    If $text400 <> $text100 And $text400 <> $text200 And $text400 <> $text300 Then ExitLoop
    WEnd
    EndIf
    $text500 = random(1, 9, 1)
    If $text500 = $text100 Or $text500 = $text200 Or $text500 = $text300 Or $text500 = $text400 Then
    While 1
    $text500 = Random (1, 9, 1)
    If $text500 <> $text100 And $text500 <> $text200 And $text500 <> $text300 And $text500 <> $text400 Then ExitLoop
    WEnd
    EndIf
    $text600 = random(1, 9, 1)
    If $text600 = $text100 Or $text600 = $text200 Or $text600 = $text300 Or $text600 = $text400 Or $text600 = $text500 Then
    While 1
    $text600 = Random (1, 9, 1)
    If $text600 <> $text100 And $text600 <> $text200 And $text600 <> $text300 And $text600 <> $text400 And $text600 <> $text500 Then ExitLoop
    WEnd
    EndIf
    $text700 = random(1, 9, 1)
    If $text700 = $text100 Or $text700 = $text200 Or $text700 = $text300 Or $text700 = $text400 Or $text700 = $text500 Or $text700 = $text600 Then
    While 1
    $text700 = Random (1, 9, 1)
    If $text700 <> $text100 And $text700 <> $text200 And $text700 <> $text300 And $text700 <> $text400 And $text700 <> $text500 And $text700 <> $text600 Then ExitLoop
    WEnd
    EndIf
    $text800 = random(1, 9, 1)
    If $text800 = $text100 Or $text800 = $text200 Or $text800 = $text300 Or $text800 = $text400 Or $text800 = $text500 Or $text800 = $text600 Or $text800 = $text700 Then
    While 1
    $text800 = Random (1, 9, 1)
    If $text800 <> $text100 And $text800 <> $text200 And $text800 <> $text300 And $text800 <> $text400 And $text800 <> $text500 And $text800 <> $text600 And $text800 <> $text700 Then ExitLoop
    WEnd
    EndIf
    $text900 = random(1, 9, 1)
    If $text900 = $text100 Or $text900 = $text200 Or $text900 = $text300 Or $text900 = $text400 Or $text900 = $text500 Or $text900 = $text600 Or $text900 = $text700 Or $text900 = $text800 Then
    While 1
    $text900 = Random (1, 9, 1)
    If $text900 <> $text100 And $text900 <> $text200 And $text900 <> $text300 And $text900 <> $text400 And $text900 <> $text500 And $text900 <> $text600 And $text900 <> $text700 And $text900 <> $text800 Then ExitLoop
    WEnd
    EndIf
    $text1000 = Random(1, 9, 1)
    $text2000 = Random(1, 9, 1)
    If $text1000 = $text2000 Then
    While 1
    $text2000 = Random(1, 9, 1)
    If $text1000 <> $text2000 Then ExitLoop
    WEnd
    EndIf
    $text3000 = random(1, 9, 1)
    If $text3000 = $text1000 Or $text3000 = $text2000 Then
    While 1
    $text3000 = Random (1, 9, 1)
    If $text3000 <> $text1000 And $text3000 <> $text2000 Then ExitLoop
    WEnd
    EndIf
    $text4000 = random(1, 9, 1)
    If $text4000 = $text1000 Or $text4000 = $text2000 Or $text4000 = $text3000 Then
    While 1
    $text4000 = Random (1, 9, 1)
    If $text4000 <> $text1000 And $text4000 <> $text2000 And $text4000 <> $text3000 Then ExitLoop
    WEnd
    EndIf
    $text5000 = random(1, 9, 1)
    If $text5000 = $text1000 Or $text5000 = $text2000 Or $text5000 = $text3000 Or $text5000 = $text4000 Then
    While 1
    $text5000 = Random (1, 9, 1)
    If $text5000 <> $text1000 And $text5000 <> $text2000 And $text5000 <> $text3000 And $text5000 <> $text4000 Then ExitLoop
    WEnd
    EndIf
    $text6000 = random(1, 9, 1)
    If $text6000 = $text1000 Or $text6000 = $text2000 Or $text6000 = $text3000 Or $text6000 = $text4000 Or $text6000 = $text5000 Then
    While 1
    $text6000 = Random (1, 9, 1)
    If $text6000 <> $text1000 And $text6000 <> $text2000 And $text6000 <> $text3000 And $text6000 <> $text4000 And $text6000 <> $text5000 Then ExitLoop
    WEnd
    EndIf
    $text7000 = random(1, 9, 1)
    If $text7000 = $text1000 Or $text7000 = $text2000 Or $text7000 = $text3000 Or $text7000 = $text4000 Or $text7000 = $text5000 Or $text7000 = $text6000 Then
    While 1
    $text7000 = Random (1, 9, 1)
    If $text7000 <> $text1000 And $text7000 <> $text2000 And $text7000 <> $text3000 And $text7000 <> $text4000 And $text7000 <> $text5000 And $text7000 <> $text6000 Then ExitLoop
    WEnd
    EndIf
    $text8000 = random(1, 9, 1)
    If $text8000 = $text1000 Or $text8000 = $text2000 Or $text8000 = $text3000 Or $text8000 = $text4000 Or $text8000 = $text5000 Or $text8000 = $text6000 Or $text8000 = $text7000 Then
    While 1
    $text8000 = Random (1, 9, 1)
    If $text8000 <> $text1000 And $text8000 <> $text2000 And $text8000 <> $text3000 And $text8000 <> $text4000 And $text8000 <> $text5000 And $text8000 <> $text6000 And $text8000 <> $text7000 Then ExitLoop
    WEnd
    EndIf
    $text9000 = random(1, 9, 1)
    If $text9000 = $text1000 Or $text9000 = $text2000 Or $text9000 = $text3000 Or $text9000 = $text4000 Or $text9000 = $text5000 Or $text9000 = $text6000 Or $text9000 = $text7000 Or $text9000 = $text8000 Then
    While 1
    $text9000 = Random (1, 9, 1)
    If $text9000 <> $text1000 And $text9000 <> $text2000 And $text9000 <> $text3000 And $text9000 <> $text4000 And $text9000 <> $text5000 And $text9000 <> $text6000 And $text9000 <> $text7000 And $text9000 <> $text8000 Then ExitLoop
    WEnd
    EndIf
    $text10000 = Random(1, 9, 1)
    $text20000 = Random(1, 9, 1)
    If $text10000 = $text20000 Then
    While 1
    $text20000 = Random(1, 9, 1)
    If $text10000 <> $text20000 Then ExitLoop
    WEnd
    EndIf
    $text30000 = random(1, 9, 1)
    If $text30000 = $text10000 Or $text30000 = $text20000 Then
    While 1
    $text30000 = Random (1, 9, 1)
    If $text30000 <> $text10000 And $text30000 <> $text20000 Then ExitLoop
    WEnd
    EndIf
    $text40000 = random(1, 9, 1)
    If $text40000 = $text10000 Or $text40000 = $text20000 Or $text40000 = $text30000 Then
    While 1
    $text40000 = Random (1, 9, 1)
    If $text40000 <> $text10000 And $text40000 <> $text20000 And $text40000 <> $text30000 Then ExitLoop
    WEnd
    EndIf
    $text50000 = random(1, 9, 1)
    If $text50000 = $text10000 Or $text50000 = $text20000 Or $text50000 = $text30000 Or $text50000 = $text40000 Then
    While 1
    $text50000 = Random (1, 9, 1)
    If $text50000 <> $text10000 And $text50000 <> $text20000 And $text50000 <> $text30000 And $text50000 <> $text40000 Then ExitLoop
    WEnd
    EndIf
    $text60000 = random(1, 9, 1)
    If $text60000 = $text10000 Or $text60000 = $text20000 Or $text60000 = $text30000 Or $text60000 = $text40000 Or $text60000 = $text50000 Then
    While 1
    $text60000 = Random (1, 9, 1)
    If $text60000 <> $text10000 And $text60000 <> $text20000 And $text60000 <> $text30000 And $text60000 <> $text40000 And $text60000 <> $text50000 Then ExitLoop
    WEnd
    EndIf
    $text70000 = random(1, 9, 1)
    If $text70000 = $text10000 Or $text70000 = $text20000 Or $text70000 = $text30000 Or $text70000 = $text40000 Or $text70000 = $text50000 Or $text70000 = $text60000 Then
    While 1
    $text70000 = Random (1, 9, 1)
    If $text70000 <> $text10000 And $text70000 <> $text20000 And $text70000 <> $text30000 And $text70000 <> $text40000 And $text70000 <> $text50000 And $text70000 <> $text60000 Then ExitLoop
    WEnd
    EndIf
    $text80000 = random(1, 9, 1)
    If $text80000 = $text10000 Or $text80000 = $text20000 Or $text80000 = $text30000 Or $text80000 = $text40000 Or $text80000 = $text50000 Or $text80000 = $text60000 Or $text80000 = $text70000 Then
    While 1
    $text80000 = Random (1, 9, 1)
    If $text80000 <> $text10000 And $text80000 <> $text20000 And $text80000 <> $text30000 And $text80000 <> $text40000 And $text80000 <> $text50000 And $text80000 <> $text60000 And $text80000 <> $text70000 Then ExitLoop
    WEnd
    EndIf
    $text90000 = random(1, 9, 1)
    If $text90000 = $text10000 Or $text90000 = $text20000 Or $text90000 = $text30000 Or $text90000 = $text40000 Or $text90000 = $text50000 Or $text90000 = $text60000 Or $text90000 = $text70000 Or $text90000 = $text80000 Then
    While 1
    $text90000 = Random (1, 9, 1)
    If $text90000 <> $text10000 And $text90000 <> $text20000 And $text90000 <> $text30000 And $text90000 <> $text40000 And $text90000 <> $text50000 And $text90000 <> $text60000 And $text90000 <> $text70000 And $text90000 <> $text80000 Then ExitLoop
    WEnd
    EndIf
    $text11 = Random(1, 9, 1)
    $text22 = Random(1, 9, 1)
    If $text11 = $text22 Then
    While 1
    $text22 = Random(1, 9, 1)
    If $text11 <> $text22 Then ExitLoop
    WEnd
    EndIf
    $text33 = random(1, 9, 1)
    If $text33 = $text11 Or $text33 = $text22 Then
    While 1
    $text33 = Random (1, 9, 1)
    If $text33 <> $text11 And $text33 <> $text22 Then ExitLoop
    WEnd
    EndIf
    $text44 = random(1, 9, 1)
    If $text44 = $text11 Or $text44 = $text22 Or $text44 = $text33 Then
    While 1
    $text44 = Random (1, 9, 1)
    If $text44 <> $text11 And $text44 <> $text22 And $text44 <> $text33 Then ExitLoop
    WEnd
    EndIf
    $text55 = random(1, 9, 1)
    If $text55 = $text11 Or $text55 = $text22 Or $text55 = $text33 Or $text55 = $text44 Then
    While 1
    $text55 = Random (1, 9, 1)
    If $text55 <> $text11 And $text55 <> $text22 And $text55 <> $text33 And $text55 <> $text44 Then ExitLoop
    WEnd
    EndIf
    $text66 = random(1, 9, 1)
    If $text66 = $text11 Or $text66 = $text22 Or $text66 = $text33 Or $text66 = $text44 Or $text66 = $text55 Then
    While 1
    $text66 = Random (1, 9, 1)
    If $text66 <> $text11 And $text66 <> $text22 And $text66 <> $text33 And $text66 <> $text44 And $text66 <> $text55 Then ExitLoop
    WEnd
    EndIf
    $text77 = random(1, 9, 1)
    If $text77 = $text11 Or $text77 = $text22 Or $text77 = $text33 Or $text77 = $text44 Or $text77 = $text55 Or $text77 = $text66 Then
    While 1
    $text77 = Random (1, 9, 1)
    If $text77 <> $text11 And $text77 <> $text22 And $text77 <> $text33 And $text77 <> $text44 And $text77 <> $text55 And $text77 <> $text66 Then ExitLoop
    WEnd
    EndIf
    $text88 = random(1, 9, 1)
    If $text88 = $text11 Or $text88 = $text22 Or $text88 = $text33 Or $text88 = $text44 Or $text88 = $text55 Or $text88 = $text66 Or $text88 = $text77 Then
    While 1
    $text88 = Random (1, 9, 1)
    If $text88 <> $text11 And $text88 <> $text22 And $text88 <> $text33 And $text88 <> $text44 And $text88 <> $text55 And $text88 <> $text66 And $text88 <> $text77 Then ExitLoop
    WEnd
    EndIf
    $text99 = random(1, 9, 1)
    If $text99 = $text11 Or $text99 = $text22 Or $text99 = $text33 Or $text99 = $text44 Or $text99 = $text55 Or $text99 = $text66 Or $text99 = $text77 Or $text99 = $text88 Then
    While 1
    $text99 = Random (1, 9, 1)
    If $text99 <> $text11 And $text99 <> $text22 And $text99 <> $text33 And $text99 <> $text44 And $text99 <> $text55 And $text99 <> $text66 And $text99 <> $text77 And $text99 <> $text88 Then ExitLoop
    WEnd
    EndIf
    Dim $text001[6] = [$text1, $text10, $text100, $text1000, $text1000, $text11]
    Dim $text002[6] = [$text2, $text20, $text200, $text2000, $text2000, $text22]
    Dim $text003[6] = [$text3, $text30, $text300, $text3000, $text3000, $text33]
    Dim $text004[6] = [$text4, $text40, $text400, $text4000, $text4000, $text44]
    Dim $text005[6] = [$text5, $text50, $text500, $text5000, $text5000, $text55]
    Dim $text006[6] = [$text6, $text60, $text600, $text6000, $text6000, $text66]
    Dim $text007[6] = [$text7, $text70, $text700, $text7000, $text7000, $text77]
    Dim $text008[6] = [$text8, $text80, $text800, $text8000, $text8000, $text88]
    Dim $text009[6] = [$text9, $text90, $text900, $text9000, $text9000, $text99]
    $count = 0
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 499, 213, 555, 230)
    Global $Button1 = GUICtrlCreateButton($text001[0], 72, 48, 33, 33)
    Global $Button2 = GUICtrlCreateButton($text002[0], 112, 48, 33, 33)
    Global $Button3 = GUICtrlCreateButton($text003[0], 152, 48, 33, 33)
    Global $Button4 = GUICtrlCreateButton($text004[0], 192, 48, 33, 33)
    Global $Button5 = GUICtrlCreateButton($text005[0], 232, 48, 33, 33)
    Global $Button6 = GUICtrlCreateButton($text006[0], 272, 48, 33, 33)
    Global $Button7 = GUICtrlCreateButton($text007[0], 312, 48, 33, 33)
    Global $Button8 = GUICtrlCreateButton($text008[0], 352, 48, 33, 33)
    Global $Button9 = GUICtrlCreateButton($text009[0], 392, 48, 33, 33)
    $Button10 = GUICtrlCreateButton("Löschen", 80, 152, 97, 41)
    $Button11 = GUICtrlCreateButton("OK", 280, 152, 97, 41)
    $Input1 = GUICtrlCreateInput("", 88, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Input2 = GUICtrlCreateInput("", 144, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Input3 = GUICtrlCreateInput("", 200, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Input4 = GUICtrlCreateInput("", 256, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Input5 = GUICtrlCreateInput("", 312, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Input6 = GUICtrlCreateInput("", 368, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $a = ""
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _Func1($text001)
    Case $Button2
    _Func1($text002)
    Case $Button3
    _Func1($text003)
    Case $Button4
    _Func1($text004)
    Case $Button5
    _Func1($text005)
    Case $Button6
    _Func1($text006)
    Case $Button7
    _Func1($text007)
    Case $Button8
    _Func1($text008)
    Case $Button9
    _Func1($text009)
    Case $Button10
    _Func2()
    EndSwitch
    WEnd
    Func _Func1($wert)
    Switch $count
    Case 0
    GUICtrlSetData($Input1, $wert[$count])
    Case 1
    GUICtrlSetData($Input2, $wert[$count])
    Case 2
    GUICtrlSetData($Input3, $wert[$count])
    Case 3
    GUICtrlSetData($Input4, $wert[$count])
    Case 4
    GUICtrlSetData($Input5, $wert[$count])
    Case 5
    GUICtrlSetData($Input6, $wert[$count])

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

    EndSwitch

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

    $count = $count + 1
    If $count < 5 Then
    GUICtrlSetData($Button1, $text001[$count])
    GUICtrlSetData($Button2, $text002[$count])
    GUICtrlSetData($Button3, $text003[$count])
    GUICtrlSetData($Button4, $text004[$count])
    GUICtrlSetData($Button5, $text005[$count])
    GUICtrlSetData($Button6, $text006[$count])
    GUICtrlSetData($Button7, $text007[$count])
    GUICtrlSetData($Button8, $text008[$count])
    GUICtrlSetData($Button9, $text009[$count])
    ElseIf $count > 5 Then
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUICtrlSetState($Button4, $GUI_DISABLE)
    GUICtrlSetState($Button5, $GUI_DISABLE)
    GUICtrlSetState($Button6, $GUI_DISABLE)
    GUICtrlSetState($Button7, $GUI_DISABLE)
    GUICtrlSetState($Button8, $GUI_DISABLE)
    GUICtrlSetState($Button9, $GUI_DISABLE)
    $count = 0
    EndIf
    EndFunc

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

    Func _Func2()
    GUICtrlSetData($Button1, $text1)
    GUICtrlSetData($Button2, $text2)
    GUICtrlSetData($Button3, $text3)
    GUICtrlSetData($Button4, $text4)
    GUICtrlSetData($Button5, $text5)
    GUICtrlSetData($Button6, $text6)
    GUICtrlSetData($Button7, $text7)
    GUICtrlSetData($Button8, $text8)
    GUICtrlSetData($Button9, $text9)
    GUICtrlSetData($Input1, "")
    GUICtrlSetData($Input2, "")
    GUICtrlSetData($Input3, "")
    GUICtrlSetData($Input4, "")
    GUICtrlSetData($Input5, "")
    GUICtrlSetData($Input6, "")
    GUICtrlSetState($Button1, $GUI_ENABLE)
    GUICtrlSetState($Button2, $GUI_ENABLE)
    GUICtrlSetState($Button3, $GUI_ENABLE)
    GUICtrlSetState($Button4, $GUI_ENABLE)
    GUICtrlSetState($Button5, $GUI_ENABLE)
    GUICtrlSetState($Button6, $GUI_ENABLE)
    GUICtrlSetState($Button7, $GUI_ENABLE)
    GUICtrlSetState($Button8, $GUI_ENABLE)
    GUICtrlSetState($Button9, $GUI_ENABLE)
    $count = 0

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

    EndFunc

    [/autoit]

    danke schon mal :thumbup:

    EDIT: kann man die variablen auch neu berechnen lassen? des es atm so ist das nach den 6 eingaben sich die variablen wiederholen ... das sollten sie nicht.

    2 Mal editiert, zuletzt von nuyx (18. Januar 2012 um 13:59)

  • Wie wäre es hiermit? :P

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>

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

    Dim $aIntArray[7][10]
    For $z = 1 To 10
    For $i = 1 To 6
    _NewRandomInt($aIntArray,$i,$z)
    Next
    Next
    _ArrayDisplay($aIntArray)
    Func _NewRandomInt(ByRef $avArray,$Row,$Dimension)
    Local $RandomInt = Random(1,9,1)
    Local $p = 1, $Error = False
    Local $aBound = UBound($avArray)-1
    Local $aDimension = $Dimension-1
    ConsoleWrite('DEBUG >> '&@CRLF &' ROW >> '&$Row&@CRLF& ' DIM >> '&$aDimension&@CRLF)
    For $p = 1 To $aBound
    If $avArray[$p][$aDimension] = $RandomInt Then
    $Error = True
    EndIf
    Next
    If $Error = True Then
    _NewRandomInt($aIntArray,$i,$z)
    Else
    $avArray[$Row][$aDimension] = $RandomInt
    EndIf
    EndFunc

    [/autoit]

    Gruß Marvin

  • danke für deine antwort nur seh ich noch nicht richtig wie genau es mir helfen könnte.

    ich will das das skript folgendes macht: 9 buttons mit zahlen von 1-9 random ohne doppelter zahl.

    man kann es sich vorstellen wie eine passwort abfrage nur ein bischen anders :D also 6 zahlen eingeben dabei ändern die buttons ihre zahl bei jedem neuem klick.

    nun kann ich mir vorstellen das man dies mit hilfe von arrays machen kann nur weiss ich nicht wie ich die zahlen dann noch random halten kann.

    in deinem bsp. sind die werte zwar random aber es gibt doppelte zahlen. ich will nicht das ihr mir das skript neu schreibt aber mir fehlt einfach der ansatz wie ich die variablen aners bestimmen kann.

  • Also ich verstehe immer noch nicht den Sinn hinter dem ganzen 8| aber mal zur erklärung, meine Funktion baut dir ein 9D Array, in jeder Dimension befinden sich 6 Einträge mit Random Zahlen, Doppelte innerhalb einer Dimension werden herrausgefiltert, Doppelte auch noch zwischen den Dimensionen zu vermeiden ist nicht möglich da deine Random Zahlen nur bis 10 gehen, dass Array was dir die Funktion baut wird dir doch angezeigt? und nun kannst du damit doch super arbeiten oder nicht? sehe dass Problem momentan nicht..

    Gruß Marvin

  • Hallo nuyx,

    wie du an diesem Skript:

    [autoit]

    #include <Array.au3>

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

    Global $aRandNr[10]
    Global $aNr[10]
    For $i = 0 To 9
    $aNr[$i] = $i
    Next

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

    For $i = 0 To 9
    $j = Random(0, UBound($aNr) - 1, 1)
    $aRandNr[$i] = $aNr[$j]
    ;ConsoleWrite($aRandNr[$i] & @TAB)
    _ArrayDelete($aNr, $j)
    ;_ArrayDisplay($aNr,"Zahlen im Lostopf")
    Next
    _ArrayDisplay($aRandNr,"Zufallszahlen")
    ;ConsoleWrite(@CRLF)

    [/autoit]

    erkennst kannst du beim Ermitteln der Zufallszahlen einiges kürzen. Falls du das Verfahren nicht verstehst solltest du die auskommentierten Zeilen aktivieren,

    mfg autoBert

  • nun kann ich mir vorstellen das man dies mit hilfe von arrays machen kann


    Richtiger Ansatz.
    Wenn man dann noch den OnEvent-Mode für die GUI nimmt kann man sich wirklich eine Menge an Code zusammenschrumpfen.
    Ein Beispiel:

    Spoiler anzeigen
    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>

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

    Opt("GUIOnEventMode", 1) ; Aktiviert den GUI-Event-Mode statt dem Message-Loop-Mode (statt GuiGetMsg() dauernd abzufragen werden GUI-Ereignisse mit Funktionen verknüpft)

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

    Global $i_Counter = 0 ; Zähler in welches Feld grad geschrieben wird

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

    #region ################ GUI erstellen ################################################
    GUICreate("meine GUI", 499, 213, 555, 230)
    GUISetOnEvent($GUI_EVENT_CLOSE, "GuiFuncs") ; verknüpft die Ereignisse Schließen-Knopf gedrückt, minimieren,-maximieren gedrückt mit der Funktion "GUIFuncs"
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "GuiFuncs")
    GUISetOnEvent($GUI_EVENT_RESTORE, "GuiFuncs")

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

    Global $a_Buttons[9] ; Erstelle alle Buttons und schreibe ihre Control-IDs in ein Array
    For $i = 0 To 8
    $a_Buttons[$i] = GUICtrlCreateButton("", 72 + $i * 40, 48, 33, 33)
    GUICtrlSetOnEvent(-1, "click_Number") ; Verknüpfe den Klick auf den aktuellen Button mit der Funktion "click_Number"
    Next
    randomize()

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

    Global $a_Inputs[6] ; Erstelle alle Inputs und schreibe ihre Control-IDs in ein Array
    For $i = 0 To 5
    $a_Inputs[$i] = GUICtrlCreateInput("", 74 + $i * 60, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
    Next

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

    $But_Loesch = GUICtrlCreateButton("Löschen", 80, 152, 97, 41)
    GUICtrlSetOnEvent(-1, "click_Loesch") ; Verknüpfe den Klick auf den Lösch-Button mit der Funktion "click_Loesch"
    $But_OK = GUICtrlCreateButton("OK", 280, 152, 97, 41)
    GUICtrlSetOnEvent(-1, "click_OK") ; Verknüpfe den Klick auf den OK-Button mit der Funktion "click_OK"
    #endregion ################ GUI erstellen ################################################

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

    GUISetState(@SW_SHOW)

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

    While 1 ; Endlosschleife
    Sleep(1000)
    WEnd

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

    ; Funktion die beim Drücken des Button "Löschen" ausgeführt wird
    Func click_Loesch()
    $i_Counter = 0
    For $i = 0 To 8
    GUICtrlSetState($a_Buttons[$i], $GUI_ENABLE)
    Next
    For $i = 0 To 5
    GUICtrlSetData($a_Inputs[$i], "")
    Next
    EndFunc ;==>click_Loesch

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

    ; Funktion die beim Drücken des Button "OK" ausgeführt wird
    Func click_OK()
    randomize()
    EndFunc ;==>click_OK

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

    ; Funktion die beim Drücken eines der Zahlen-buttons ausgeführt wird
    ; Welcher Button das genau war (also welche Control-ID) wird intern mit dem Makro @GUI_CtrlId bestimmt)
    Func click_Number()
    GUICtrlSetData($a_Inputs[$i_Counter], GUICtrlRead(@GUI_CtrlId))
    $i_Counter += 1
    If $i_Counter = 8 Then
    For $i = 0 To 8
    GUICtrlSetState($a_Buttons[$i], $GUI_DISABLE)
    Next
    EndIf
    Randomize()
    EndFunc ;==>click_Number

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

    ; Gibt allen Zahlenbuttons neue zufällige Zahlen wobei jede nur einmal vorkommen darf
    Func Randomize()
    Local $s_Zahlen = "123456789", $x = 9, $rnd

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

    For $i = 0 To 8
    $rnd = Random(1, $x, 1)
    If $x = 1 Then $rnd = 1
    $Zahl = StringMid($s_Zahlen, $rnd, 1)
    $s_Zahlen = StringReplace($s_Zahlen, $Zahl, "")
    $x -= 1
    GUICtrlSetData($a_Buttons[$i], $Zahl)
    Next
    EndFunc ;==>Randomize

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

    ; Behandelt die GUI-Ereignisse Schließen, Minimieren, Wiederherstellen:
    Func GuiFuncs()
    Switch @GUI_CtrlId
    Case $GUI_EVENT_CLOSE
    Exit
    Case $GUI_EVENT_MINIMIZE
    GUISetState(@SW_MINIMIZE, @GUI_WinHandle)
    Case $GUI_EVENT_RESTORE
    GUISetState(@SW_RESTORE, @GUI_WinHandle)
    EndSwitch
    EndFunc ;==>GuiFuncs

    [/autoit]


    meine Funktion baut dir ein 9D Array

    Es ist kein 9D Array sondern ein 2D-Array mit einer Dimensionsgröße von 7 in der ersten Dimension und 10 in der 2. Dimension.

    Einmal editiert, zuletzt von AspirinJunkie (18. Januar 2012 um 14:28)

  • dankeschön ich werds mir mal durcharbeiten und rumprobieren :thumbup:

    melde mich danach nochmal (vielleicht dann schon mit dem geschrumpften skript? ;) )

    nun erstmal schlafen :sleeping: (das thema stell ich mal auf gelöst bis dahin)

    edit: @AspirinJunkie sehe grad das du mein sript schon fertig gemacht hast o.0 nimmt mir meine aufgabe weg ;(

    :P werds mir trotzdem anschaun :)

    Einmal editiert, zuletzt von nuyx (18. Januar 2012 um 14:05)

  • Hab noch etwas rumgebastelt musst dir die Func dann so anpassen noch dass die Doppelten innerhalb einer Dimension kommen dürfen aber nicht zwischen den Dimensionen ist ja kein Problem

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>

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

    Dim $aIntArray[7][10]
    Dim $aButton[10],$aInput[7]
    Local $Pixel = 72, $Pixel2 = 88, $CurrentInput = 1
    For $z = 1 To 10
    For $i = 1 To 6
    _NewRandomInt($aIntArray,$i,$z)
    Next
    Next
    ;_ArrayDisplay($aIntArray)

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

    $hGUI = GUICreate("ZahlenDing", 499, 213)
    $btnDel = GUICtrlCreateButton("Löschen", 80, 152, 97, 41)
    $btnOK = GUICtrlCreateButton("OK", 280, 152, 97, 41)
    For $i = 1 To 9
    $aButton[$i] = GUICtrlCreateButton($aIntArray[1][$i],$Pixel,48, 33, 33)
    $Pixel += 40
    Next
    For $i = 1 To 6
    $aInput[$i] = GUICtrlCreateInput("", $Pixel2, 104, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $Pixel2 += 56
    Next
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $aButton[1] To $aButton[9]
    ConsoleWrite("Button geklickt, Control ID: "&$nMsg&@CRLF)
    _ButtonClicked($nMsg)
    _ChangeData()
    Case $btnDel
    _DelAndEnable()
    EndSwitch
    WEnd
    Func _ButtonClicked($hButton)
    GUICtrlSetData($aInput[$CurrentInput],GUICtrlRead($hButton))
    $CurrentInput += 1

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

    If $CurrentInput > 6 Then
    _Disable()
    EndIf
    EndFunc

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

    Func _Disable()
    For $i = 1 To UBound($aButton)-1
    GUICtrlSetState($aButton[$i],$GUI_DISABLE)
    Next
    EndFunc

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

    Func _ChangeData()
    For $i = 1 To UBound($aButton)-1
    GUICtrlSetData($aButton[$i],$aIntArray[$CurrentInput-1][$i])
    Next
    EndFunc
    Func _DelAndEnable()
    $CurrentInput = 1
    For $i = 1 To UBound($aInput)-1
    GUICtrlSetData($aInput[$i],'')
    Next
    For $i = 1 To UBound($aIntArray,2)-1
    GUICtrlSetData($aButton[$i],$aIntArray[1][$i])
    Next
    For $i = 1 To UBound($aButton)-1
    GUICtrlSetState($aButton[$i],$GUI_ENABLE)
    Next
    EndFunc

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

    Func _NewRandomInt(ByRef $avArray,$Row,$Dimension)
    Local $RandomInt = Random(1,9,1)
    Local $p = 1, $Error = False
    Local $aBound = UBound($avArray)-1
    Local $aDimension = $Dimension-1
    ;ConsoleWrite('DEBUG >> '&@CRLF &' ROW >> '&$Row&@CRLF& ' DIM >> '&$aDimension&@CRLF)
    For $p = 1 To $aBound
    If $avArray[$p][$aDimension] = $RandomInt Then
    $Error = True
    EndIf
    Next
    If $Error = True Then
    _NewRandomInt($aIntArray,$i,$z)
    Else
    $avArray[$Row][$aDimension] = $RandomInt
    EndIf
    EndFunc

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

    Gruß Marvin