AutoIt als karteikarten ersetzer

  • Wie währe es wenn mal jemand die Vokabeln.txt Postet?

    habe ich zwar oben schonmal aber hier für dich ;)

    Spoiler anzeigen

    [Deutsch]
    1=Hallo
    2=Welt
    3=...
    4=...
    5=...
    ...

    [Englisch]
    1=hello
    2=world
    3=...
    4=...
    5=...
    ...

  • okay ich hab meins etwas weitergeführt..
    manchmal (scheinbar zufällig? O.o) kommt dieser Fehler. Keine ahnung woran das liegt..(oder vllt an dem falsch verwendeten random?)

    Code
    C:\Dokumente und Einstellungen\XXxxxxXXXxxxX\Eigene Dateien\autoit\vokabeln\vokabel_1.au3 (42) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
    ToolTip ("Richtig ist: " & $voc[2], 500, 500)
    ToolTip ("Richtig ist: " & ^ ERROR

    hier die vokabeln:

    Spoiler anzeigen


    Hallo;hello
    rennen;run
    gehen;walk
    schauen;look
    lügen;lie
    kauen;chew
    drehen;turn
    lippen;lips
    augen;eyes

    hier das script:

    Spoiler anzeigen
    [autoit]


    ;includes
    #include "file.au3"
    ;include Ende

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

    ;Variablen
    Dim $arvocs
    Dim $allvocs
    Dim $voc
    ;Variablen Ende

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

    ;Vokabeln auslesen
    _FileReadToArray (@scriptdir & "\vokabeln.txt", $arvocs)
    $allvocs = UBound ($arvocs)
    ;Vokabeln auslesen Ende

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

    ;ToolTip
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    $voc = StringSplit ($voc, ";")
    ToolTip ($voc[1], 500, 500)
    ;ToolTip Ende

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

    ;GUI
    $Form1 = GUICreate("Vokabeltester", 100, 80, 300, 10)
    $input = GUICtrlCreateInput ("" , 10, 10, 80, 20)
    $ok = GUICtrlCreateButton ("OK", 40, 40)
    GUISetState (@sw_show)
    ;Gui Ende

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

    ;Warten aufs ausfüllen
    While 1
    $bla = GUIGetMsg()
    switch $bla
    Case $ok
    _next()
    EndSwitch
    WEnd
    ;Warten Ende

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

    ;Schleife, die die nächste Vokabel erstellt
    Func _next()
    GUISetState (@SW_hide)
    GUICtrlSetData ($input, "")
    ToolTip ("Richtig ist: " & $voc[2], 500, 500)
    Sleep (2000)
    $arvocs[$random] = ""
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    $voc = StringSplit ($voc, ";")
    If $voc[1] = "" Then
    _next()
    EndIf
    ToolTip ($voc[1], 500, 500)
    GUISetState (@SW_show)
    EndFunc
    ;Schleife Ende

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


    PS: vielen dank an den threadersteller, das ist eine echt gute anwendung zum dazulernen! ein paar sachen die ich oben verwende habe ich ebengrade erst erlernt!


    Edit: Einen Fehler gefunden und korrigiert.

    3 Mal editiert, zuletzt von unaimed (10. März 2009 um 18:48)

  • Ich hab das Alte gerad mal Durchgegeguck!

    Spoiler anzeigen
    [autoit]

    #include <StaticConstants.au3>
    #include <Misc.au3>

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

    Global $Counter = Random (1,100,1), $deutsch , $englisch, $dll = DllOpen("user32.dll"), $test
    $Old = ""
    While 1
    $deutsch = IniReadSection(@ScriptDir & "\Vokabeln.txt","Deutsch")
    $englisch = IniReadSection(@ScriptDir & "\Vokabeln.txt","Englisch")
    Do
    $1 = Random (1,$deutsch[0][0] +1)
    Until $1 <> $Old
    $Old = $1
    ToolTip("Deutsch",500,500,$deutsch[$1][1],"",1)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    ToolTip("Englisch",500,500,$englisch[$1][1],"",3)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    WEnd

    [/autoit]

    mfg. Jam00

  • So... hab meins mit hilfe von stringsplit usw jetzt mal geändert ;)

    Quellcode:

    Spoiler anzeigen
    [autoit]

    #include <StaticConstants.au3>
    #include <Misc.au3>
    #include "file.au3"
    #include <Array.au3>

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

    Dim $dll = DllOpen("user32.dll")
    Dim $arvocs
    Dim $allvocs
    Dim $englisch
    Dim $deutsch
    Dim $test

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

    While 1
    _FileReadToArray (@scriptdir & "\vokabeln.txt", $arvocs)
    $allvocs = UBound ($arvocs)
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    If $voc == "" Then
    Do
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    Until $voc <> ""
    EndIf
    $i = StringSplit ($voc, "=")
    ToolTip("Deutsch",500,500,$i[1],"",1)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    ToolTip("Englisch",500,500,$i[2],"",3)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    WEnd

    [/autoit]

    Vokabeln.txt:

    Spoiler anzeigen

    Hallo=Hello
    Welt=World
    Richtig=Right
    Falsch=Wrong
    rennen=run
    essen=eat
    trinken=drink

    Edit: Hmm komisch... manchmal bekomme ich nen error:
    $voc = $arvocs[$random]
    $voc = ^ ERROR

    Keine ahnung warum... kann sich das vielleicht mal einer anschauen ?

    3 Mal editiert, zuletzt von SiLenCa (10. März 2009 um 18:57)

  • So:

    Spoiler anzeigen
    [autoit]

    #include <StaticConstants.au3>
    #include <Misc.au3>
    #include "file.au3"
    #include <Array.au3>

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

    Dim $dll = DllOpen("user32.dll")
    Dim $arvocs
    Dim $allvocs
    Dim $englisch
    Dim $deutsch
    Dim $test

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

    While 1
    _FileReadToArray (@scriptdir & "\vokabeln.txt", $arvocs)
    $allvocs = UBound ($arvocs) -1
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    If $voc == "" Then
    Do
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    Until $voc <> ""
    EndIf
    $i = StringSplit ($voc, "=")
    ToolTip("Deutsch",500,500,$i[1],"",1)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    ToolTip("Englisch",500,500,$i[2],"",3)
    While 1
    IF _IsPressed ("20") Then
    While 1
    If Not _IsPressed ("20") Then ExitLoop
    WEnd
    ExitLoop
    EndIf
    Sleep (100)
    WEnd
    WEnd

    [/autoit]

    mfg. Jam00

  • Np ^^
    Hat mir auch geholfen

  • Um genaueres zu sagen müsstest du mal die Vokabeln.txt uploaden, denn es ist ein Falscher Prameter bei StringSplit denke ich, kannst ja mal so versuchen, sonst poste einfach auch mal die Vokabeln.txt

    Spoiler anzeigen
    [autoit]

    #comments-start

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

    Vokabeltrainer Version 1
    Französisch

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

    #comments-end

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

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

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

    Dim $arvocs
    Dim $allvocs
    Dim $voc

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

    ;Vokabeln auslesen
    _FileReadToArray (@scriptdir & "\vokabeln.txt", $arvocs)
    $allvocs = UBound ($arvocs) -1
    ;Vokabeln auslesen Ende

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

    ;ToolTip
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    $voc = StringSplit ($voc, "=")

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

    ;ToolTip Ende

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

    ;GUI

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

    $Form1 = GUICreate("Vokabeltester", 633, 454, 192, 124)
    $Vokabeleingabe = GUICtrlCreateInput("Vokabeleingabe", 56, 80, 209, 21)
    $Fertig = GUICtrlCreateButton("Fertig!!!", 56, 240, 209, 97, $WS_GROUP)
    GUISetState (@sw_show)
    $Abbrechen = GUICtrlCreateButton("Abbrechen", 423, 383, 145, 57, $WS_GROUP)
    $frage= GUICtrlCreateInput($voc[1], 56, 176, 209, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $Leo = GUICtrlCreateButton("Übersetzung", 240, 384, 145, 57, $WS_GROUP)
    $Informationen = GUICtrlCreateButton("Informationen", 55, 383, 145, 57, $WS_GROUP)
    $Label2 = GUICtrlCreateLabel("Gib hier die Übersetzung ein:", 64, 56, 140, 17)
    GUISetState (@sw_show)
    ;Gui Ende

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

    #include <IE.au3>

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

    ;Warten aufs ausfüllen
    While 1
    $bla = GUIGetMsg()
    switch $bla
    Case $Fertig
    _next()
    Case $Abbrechen
    Exit
    Case $Leo
    _IECreate("http://dict.leo.org/frde?lang=de&lp=frde", 0, 1, 0 )
    Case $Informationen
    MsgBox(0,"Informationen","Idee: YYYYYYY" & @CRLF & "Entwickelt: XXXXXX")
    EndSwitch
    WEnd
    ;Warten Ende

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

    ;Schleife, die die nächste Vokabel erstellt
    Func _next()

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

    GUICtrlSetData ($Vokabeleingabe, "")
    $Loesung = GUICtrlCreateInput("Richtig ist: " & $voc[2], 56, 130, 209, 21)
    Sleep (2000)
    $arvocs[$random] = ""
    $random = Random (1, $allvocs, 1)
    $voc = $arvocs[$random]
    $voc = StringSplit ($voc, "=")
    If $voc[1] = "" Then
    _next()
    EndIf
    $L = GUICtrlCreateInput($voc[1], 56, 176, 209, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    GUICtrlSetData($Loesung,"Lösung")
    EndFunc
    ;Schleife Ende

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


    Edit BugFix: persönliche Angaben entfernt

    mfg. Jam00

    Einmal editiert, zuletzt von BugFix (2. November 2011 um 20:25)