Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 08:12

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Vokabeltrainer

Discussion on Vokabeltrainer within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,241
Received Thanks: 848
Vokabeltrainer

Macht damit was ihr wollt, is mir rotzegal.
Die Inis müssen min. 3 Einträge beinhalten und sollten so aussehen:
Code:
[Vok]
Vok=Dump/Dump
Vok2=Deutsch/Übersetzung
Vok3=Deutsch/Übersetzung
...
Ich spar mir an dieser Stelle das Kompilieren und stell einfach den Source rein:
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Vokabeltrainer 0.1", 297, 150, 532, 287)
$Label1 = GUICtrlCreateLabel("", 56, 16,100,20)
$Input1 = GUICtrlCreateInput("", 16, 56, 121, 21)
$Button1 = GUICtrlCreateButton("OK/Start", 16, 88, 121, 25)
$Button2 = GUICtrlCreateButton("Liste anzeigen", 152, 14, 121, 25)
$Button3 = GUICtrlCreateButton("Neue Vokabel", 152, 54, 121, 25)
$Label2 = GUICtrlCreateLabel("", 185, 95,100,20)

$Menu = GUICtrlCreateMenu ("Sprache")
$Item = GUICtrlCreateMenuitem ("Sprache ändern",$Menu)
$Item2 = GUICtrlCreateMenuitem ("Hilfe",$Menu)
$Item3 = GUICtrlCreateMenuitem ("Credits",$Menu)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $temparray[1]
Global $tstring

$tmsg = MsgBox(4,"Hilfe anzeigen?","Hilfe anzeigen?")
If $tmsg = 6 Then
	MsgBox(0,"Hilfe","Bei jedem Start müssen Sie Ihre .ini mit den Vokabeln laden" & @crlf & "Diese ist wie folgt aufgebaut:" & @crlf & "[Vok]" & @crlf & "Vok=Dump/Dump" & @crlf & "Vok2=Vokabel1/Übersetzung1" & @crlf & "Vok3=Vokabel2/Übersetzung2" & @crlf & "..." & @crlf & @crlf & "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls Sie anfangs keine geladen haben")
	$filea = FileOpenDialog(".ini auswählen",@tempdir,".ini (*.ini)",1)
	Global $fileb = StringReplace($filea,"|","/")
Else
$filea = FileOpenDialog(".ini auswählen",@tempdir,".ini (*.ini)",1)
Global $fileb = StringReplace($filea,"|","/")
EndIf

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $Item
			$filea = FileOpenDialog(".ini auswählen",@tempdir,".ini (*.ini)",1)
			Global $fileb = StringReplace($filea,"|","/")
			_update()
		Case $Item2
			MsgBox(0,"Hilfe","Bei jedem Start müssen Sie ihre .ini mit den Vokabeln laden" & @crlf & "Diese ist wie folgt aufgebaut:" & @crlf & "[Vok]" & @crlf & "Vok=Dump/Dump" & @crlf & "Vok2=Vokabel1/Übersetzung1" & @crlf & "Vok3=Vokabel2/Übersetzung2" & @crlf & "..." & @crlf & @crlf & "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls sie anfangs keine geladen haben")
		Case $Item3
			MsgBox(0,"Credits","mipez: idea & scripting" & @CRLF & "(c) mipez, 2010")
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			_check()
		Case $Button2
			_list()
		Case $Button3
			_new()

	EndSwitch
WEnd

Func _new()
	$put = InputBox("Vokabel","Bitte die Vokabel in Deutsch eingeben")
	$put2 = InputBox("Vokabel","Übersetzung")
	$vokread = IniReadSection($fileb,"Vok")
	If @error Then
		MsgBox(0,"Neue .ini", "Es wird eine neue Vok.ini erstellt, bitte Neueingabe wiederholen")
		IniWrite($fileb,"Vok","Vok","Dump/Dump")
	Else
	IniWrite($fileb,"Vok","Vok" & $vokread[0][0]+1, $put & "/" & $put2)
	EndIf
EndFunc

Func _list()
	$hj = IniReadSection($fileb,"Vok")
	_ArrayDisplay($hj)
EndFunc



Func _update()
	$tok = IniReadSection($fileb,"Vok")
	If not @error Then
	$z =Random(2,$tok[0][0],1)
	$tak = IniRead($fileb,"Vok","Vok" & $z,"")
	$tstring = StringSplit($tak,"/")
	$z2 = Random(1,2,1)
	If $z2 = 1 Then 
		$temparray[0] = 1
	ElseIf $z2 = 2 Then 
		$temparray[0] = 2
	EndIf
	GUICtrlSetData($Label1,$tstring[$z2])
	EndIf

EndFunc

Func _check()
	$r3 = GUICtrlRead($Input1)
	$zt = FileExists($fileb)
	If NOT $zt = True Then 
		MsgBox(0,".ini nicht gefunden","Vok.ini konnte nicht gefunden werden")
	Else
		If $r3 = "" Then 
			_update()
		Else
			If $temparray[0] <> 1 Then
				If $r3 = $tstring[1] Then
					GUICtrlSetData($Label2,"Richtig!")
					GUICtrlSetData($Input1,"")
					Sleep(500)
					_update()
				Else
					GUICtrlSetData($Label2,"Falsch!")
				EndIf
			ElseIf $temparray[0] <> 2 Then
				If $r3 = $tstring[2] Then
					GUICtrlSetData($Label2,"Richtig!")
					GUICtrlSetData($Input1,"")
					Sleep(500)
					_update()
				Else
					GUICtrlSetData($Label2,"Falsch!")
				EndIf
			EndIf
		EndIf
	EndIf
EndFunc
Danke an... ach diejenigen wissen dass sie gemeint sind oô
mipez is offline  
Thanks
7 Users
Old 09/07/2010, 16:05   #2
 
HardCore.1337's Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
gute Idee.
HardCore.1337 is offline  
Old 09/07/2010, 16:07   #3
 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,241
Received Thanks: 848
Quote:
Originally Posted by HardCore.1337 View Post
gute Idee.
Hm, aber das Problem mit dem Array konnte ich bis heute nich lösen -.-
mipez is offline  
Old 09/07/2010, 20:11   #4


 
elite*gold: 0
Join Date: Sep 2008
Posts: 526
Received Thanks: 82
Hab in den Trainer mal einen Counter und Stats reingemacht
Code:

PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$nummer 0
$r 
0
$f 
0
$start 
0
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Vokabeltrainer 0.1"298121516135)
$Label1 GUICtrlCreateLabel(""16812425)
$Input1 GUICtrlCreateInput(""164812121)
$Button1 GUICtrlCreateButton("OK/Start"247297250)
$Button2 GUICtrlCreateButton("Liste anzeigen"1520137250)
$Button3 GUICtrlCreateButton("Neue Vokabel"15224137250)
$Label2 GUICtrlCreateLabel(""1525114017)
$Label3 GUICtrlCreateLabel($nummer&"/30"1527214017)

$Menu GUICtrlCreateMenu ("Sprache")
$Item GUICtrlCreateMenuitem ("Sprache ändern",$Menu)
$Item2 GUICtrlCreateMenuitem ("Hilfe",$Menu)
$Item3 GUICtrlCreateMenuitem ("Credits",$Menu)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $temparray[1]
Global 
$tstring

$tmsg 
MsgBox(4,"Hilfe anzeigen?","Hilfe anzeigen?")
If 
$tmsg 6 Then
    MsgBox
(0,"Hilfe","Bei jedem Start müssen Sie Ihre .ini mit den Vokabeln laden" & @crlf "Diese ist wie folgt aufgebaut:" & @crlf "[Vok]" & @crlf "Vok=Dump/Dump" & @crlf "Vok2=Vokabel1/Übersetzung1" & @crlf "Vok3=Vokabel2/Übersetzung2" & @crlf "..." & @crlf & @crlf "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls Sie anfangs keine geladen haben")
    
$filea FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
    Global 
$fileb StringReplace($filea,"|","/")
Else
$filea FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
Global 
$fileb StringReplace($filea,"|","/")
EndIf

While 
1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $Item
            $filea 
FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
            Global 
$fileb StringReplace($filea,"|","/")
            
_update()
        Case 
$Item2
            MsgBox
(0,"Hilfe","Bei jedem Start müssen Sie ihre .ini mit den Vokabeln laden" & @crlf "Diese ist wie folgt aufgebaut:" & @crlf "[Vok]" & @crlf "Vok=Dump/Dump" & @crlf "Vok2=Vokabel1/Übersetzung1" & @crlf "Vok3=Vokabel2/Übersetzung2" & @crlf "..." & @crlf & @crlf "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls sie anfangs keine geladen haben")
        Case 
$Item3
            MsgBox
(0,"Credits","mipez: idea & scripting"& @CRLF "mozo_: counter & stats" & @CRLF "(c) mipez, 2010")
        Case 
$GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            _check
()
        Case 
$Button2
            _list
()
        Case 
$Button3
            _new
()

    EndSwitch
WEnd

Func _new
()
    
$put InputBox("Vokabel","Bitte die Vokabel in Deutsch eingeben")
    
$put2 InputBox("Vokabel","Übersetzung")
    
$vokread IniReadSection($fileb,"Vok")
    If @
error Then
        MsgBox
(0,"Neue .ini""Es wird eine neue Vok.ini erstellt, bitte Neueingabe wiederholen")
        
IniWrite($fileb,"Vok","Vok","Dump/Dump")
    Else
    
IniWrite($fileb,"Vok","Vok" $vokread[0][0]+1$put "/" $put2)
    EndIf
EndFunc

Func _list
()
    
$hj IniReadSection($fileb,"Vok")
    
_ArrayDisplay($hj)
EndFunc

Func _update
()
    If 
$nummer <= 29 Then
        
        $tok 
IniReadSection($fileb,"Vok")
        If 
not @error Then
            $z 
=Random(2,$tok[0][0],1)
            
$tak IniRead($fileb,"Vok","Vok" $z,"")
            
$tstring StringSplit($tak,"/")
            
$z2 Random(1,2,1)
            If 
$z2 1 Then 
                $temparray
[0] = 1
            
ElseIf $z2 2 Then 
                $temparray
[0] = 2
            
EndIf
            
GUICtrlSetData($Label1,$tstring[$z2])
            
$nummer $nummer +1
            GUICtrlSetData
($Label3,$nummer "/30")
        EndIf
    Else
        
MsgBox(0,"Ergebniss""Ergebniss:" & @crlf "Richtig: " $r "" & @crlf "Falsch: " $f)
        
$r 0
        $f 
0
        $nummer 
0
        $start 
0
        GUICtrlSetData
($Label1"")
        
GUICtrlSetData($Label3"")
    EndIf
EndFunc

Func _check
()
    If 
$start 0 Then
        $start 
1
        _update
()
    Else
        
$r3 GUICtrlRead($Input1)
        
$zt FileExists($fileb)
        If 
NOT $zt True Then 
            MsgBox
(0,".ini nicht gefunden","Vok.ini konnte nicht gefunden werden")
        Else
            If 
$r3 "" Then 
                $f 
$f +1
                _update
()
            Else
                If 
$temparray[0] <> 1 Then
                    
If $r3 $tstring[1Then
                        GUICtrlSetData
($Label2,"Richtig!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
GUICtrlSetData($Input1,"")
                        
$r $r +1
                        Sleep
(500)
                        
_update()
                    Else
                        
GUICtrlSetData($Label2,"Falsch!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
$f $f +1
                        _update
()
                    EndIf
                ElseIf 
$temparray[0] <> 2 Then
                    
If $r3 $tstring[2Then
                        GUICtrlSetData
($Label2,"Richtig!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
GUICtrlSetData($Input1,"")
                        
$r $r +1
                        Sleep
(500)
                        
_update()
                    Else
                        
GUICtrlSetData($Label2,"Falsch!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
$f $f +1
                        _update
()
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc 
Mozo_ is offline  
Thanks
1 User
Old 09/07/2010, 21:52   #5
 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,241
Received Thanks: 848
Quote:
Originally Posted by Mozo_ View Post
Hab in den Trainer mal einen Counter und Stats reingemacht
Code:

PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$nummer 0
$r 
0
$f 
0
$start 
0
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Vokabeltrainer 0.1"298121516135)
$Label1 GUICtrlCreateLabel(""16812425)
$Input1 GUICtrlCreateInput(""164812121)
$Button1 GUICtrlCreateButton("OK/Start"247297250)
$Button2 GUICtrlCreateButton("Liste anzeigen"1520137250)
$Button3 GUICtrlCreateButton("Neue Vokabel"15224137250)
$Label2 GUICtrlCreateLabel(""1525114017)
$Label3 GUICtrlCreateLabel($nummer&"/30"1527214017)

$Menu GUICtrlCreateMenu ("Sprache")
$Item GUICtrlCreateMenuitem ("Sprache ändern",$Menu)
$Item2 GUICtrlCreateMenuitem ("Hilfe",$Menu)
$Item3 GUICtrlCreateMenuitem ("Credits",$Menu)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $temparray[1]
Global 
$tstring

$tmsg 
MsgBox(4,"Hilfe anzeigen?","Hilfe anzeigen?")
If 
$tmsg 6 Then
    MsgBox
(0,"Hilfe","Bei jedem Start müssen Sie Ihre .ini mit den Vokabeln laden" & @crlf "Diese ist wie folgt aufgebaut:" & @crlf "[Vok]" & @crlf "Vok=Dump/Dump" & @crlf "Vok2=Vokabel1/Übersetzung1" & @crlf "Vok3=Vokabel2/Übersetzung2" & @crlf "..." & @crlf & @crlf "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls Sie anfangs keine geladen haben")
    
$filea FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
    Global 
$fileb StringReplace($filea,"|","/")
Else
$filea FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
Global 
$fileb StringReplace($filea,"|","/")
EndIf

While 
1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $Item
            $filea 
FileOpenDialog(".ini auswählen",@ScriptDir,".ini (*.ini)",1)
            Global 
$fileb StringReplace($filea,"|","/")
            
_update()
        Case 
$Item2
            MsgBox
(0,"Hilfe","Bei jedem Start müssen Sie ihre .ini mit den Vokabeln laden" & @crlf "Diese ist wie folgt aufgebaut:" & @crlf "[Vok]" & @crlf "Vok=Dump/Dump" & @crlf "Vok2=Vokabel1/Übersetzung1" & @crlf "Vok3=Vokabel2/Übersetzung2" & @crlf "..." & @crlf & @crlf "<Neue Vokabel> erstellt einen neuen Eintrag in der geladenen .ini oder erstellt eine neue, falls sie anfangs keine geladen haben")
        Case 
$Item3
            MsgBox
(0,"Credits","mipez: idea & scripting"& @CRLF "mozo_: counter & stats" & @CRLF "(c) mipez, 2010")
        Case 
$GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            _check
()
        Case 
$Button2
            _list
()
        Case 
$Button3
            _new
()

    EndSwitch
WEnd

Func _new
()
    
$put InputBox("Vokabel","Bitte die Vokabel in Deutsch eingeben")
    
$put2 InputBox("Vokabel","Übersetzung")
    
$vokread IniReadSection($fileb,"Vok")
    If @
error Then
        MsgBox
(0,"Neue .ini""Es wird eine neue Vok.ini erstellt, bitte Neueingabe wiederholen")
        
IniWrite($fileb,"Vok","Vok","Dump/Dump")
    Else
    
IniWrite($fileb,"Vok","Vok" $vokread[0][0]+1$put "/" $put2)
    EndIf
EndFunc

Func _list
()
    
$hj IniReadSection($fileb,"Vok")
    
_ArrayDisplay($hj)
EndFunc

Func _update
()
    If 
$nummer <= 29 Then
        
        $tok 
IniReadSection($fileb,"Vok")
        If 
not @error Then
            $z 
=Random(2,$tok[0][0],1)
            
$tak IniRead($fileb,"Vok","Vok" $z,"")
            
$tstring StringSplit($tak,"/")
            
$z2 Random(1,2,1)
            If 
$z2 1 Then 
                $temparray
[0] = 1
            
ElseIf $z2 2 Then 
                $temparray
[0] = 2
            
EndIf
            
GUICtrlSetData($Label1,$tstring[$z2])
            
$nummer $nummer +1
            GUICtrlSetData
($Label3,$nummer "/30")
        EndIf
    Else
        
MsgBox(0,"Ergebniss""Ergebniss:" & @crlf "Richtig: " $r "" & @crlf "Falsch: " $f)
        
$r 0
        $f 
0
        $nummer 
0
        $start 
0
        GUICtrlSetData
($Label1"")
        
GUICtrlSetData($Label3"")
    EndIf
EndFunc

Func _check
()
    If 
$start 0 Then
        $start 
1
        _update
()
    Else
        
$r3 GUICtrlRead($Input1)
        
$zt FileExists($fileb)
        If 
NOT $zt True Then 
            MsgBox
(0,".ini nicht gefunden","Vok.ini konnte nicht gefunden werden")
        Else
            If 
$r3 "" Then 
                $f 
$f +1
                _update
()
            Else
                If 
$temparray[0] <> 1 Then
                    
If $r3 $tstring[1Then
                        GUICtrlSetData
($Label2,"Richtig!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
GUICtrlSetData($Input1,"")
                        
$r $r +1
                        Sleep
(500)
                        
_update()
                    Else
                        
GUICtrlSetData($Label2,"Falsch!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
$f $f +1
                        _update
()
                    EndIf
                ElseIf 
$temparray[0] <> 2 Then
                    
If $r3 $tstring[2Then
                        GUICtrlSetData
($Label2,"Richtig!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
GUICtrlSetData($Input1,"")
                        
$r $r +1
                        Sleep
(500)
                        
_update()
                    Else
                        
GUICtrlSetData($Label2,"Falsch!")
                        
Sleep(1000)
                        
GUICtrlSetData($Label2,"")
                        
$f $f +1
                        _update
()
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc 
Ahem, rate mal warum ich die Einträge per Zufall abrufe xD
mipez is offline  
Old 09/07/2010, 22:04   #6
 
elite*gold: 20
Join Date: Feb 2007
Posts: 3,080
Received Thanks: 4,294
hatte sowas in der art mal schnell für den einen typen da gemacht. sieht von der zeilenanzahl wesentlich kürzer aus wie deiner

kknb is offline  
Thanks
1 User
Old 09/08/2010, 00:29   #7


 
elite*gold: 0
Join Date: Sep 2008
Posts: 526
Received Thanks: 82
@mipez

hatte das auch nur so aus langeweile gemacht... dann kann man 30 vokabeln abarbeiten und gucken wie viel mach richtig bzw falsch hat
Mozo_ is offline  
Old 11/17/2010, 21:06   #8
 
iJonas's Avatar
 
elite*gold: 75
Join Date: May 2010
Posts: 934
Received Thanks: 1,285
Also habe ein paar Fragen:
Wie kann ich eine normale .ini Datei erstellen?
Wenn ich eine neue Vokabel eingebe und die Übersetzung kommt irgendetwas von Neueingabe oder so was bedeutet das?
Es kommt eine Message, dass eine neue .ini erstellt wurde wo wird die gespeichert ?
iJonas is offline  
Thanks
1 User
Old 11/17/2010, 22:05   #9
 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,241
Received Thanks: 848
Quote:
Originally Posted by iJonas View Post
Also habe ein paar Fragen:
Wie kann ich eine normale .ini Datei erstellen?
Wenn ich eine neue Vokabel eingebe und die Übersetzung kommt irgendetwas von Neueingabe oder so was bedeutet das?
Es kommt eine Message, dass eine neue .ini erstellt wurde wo wird die gespeichert ?
Hier mal das aktuelle Script:
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$Form1 = GUICreate("Vocabtrainer 0.1", 297, 150, 532, 287)
$Label1 = GUICtrlCreateLabel("", 56, 16,100,20)
$Input1 = GUICtrlCreateInput("", 16, 56, 121, 21)
$Button1 = GUICtrlCreateButton("OK/Start", 16, 88, 121, 25)
$Button2 = GUICtrlCreateButton("Show List", 152, 14, 121, 25)
$Button3 = GUICtrlCreateButton("New Entry", 152, 54, 121, 25)
$Label2 = GUICtrlCreateLabel("", 185, 95,100,20)

$Menu = GUICtrlCreateMenu ("Language")
$Item = GUICtrlCreateMenuitem ("Change Language",$Menu)
$Item2 = GUICtrlCreateMenuitem ("Help",$Menu)
$Item3 = GUICtrlCreateMenuitem ("Credits",$Menu)
GUISetState(@SW_SHOW)


Global $temparray[1]
Global $tstring

$tmsg = MsgBox(4,"Show Help?","Show Help?")
If $tmsg = 6 Then
	MsgBox(0,"Help","Every time you run this prog, you need to load your vocab .ini" & @crlf & "It's build like this:" & @crlf & "[Voc]" & @crlf & "Voc=Dump/Dump" & @crlf & "Voc2=Vocabel1/Translation1" & @crlf & "Voc3=Vocabel2/Translation2" & @crlf & "..." & @crlf & @crlf & "<New Entry> sets a new entry in your loaded .ini or creates a new one, if you haven't loaded one at the start")
	$filea = FileOpenDialog("load .ini",@tempdir,".ini (*.ini)",1)
	Global $fileb = StringReplace($filea,"|","/")
Else
$filea = FileOpenDialog("load .ini",@tempdir,".ini (*.ini)",1)
Global $fileb = StringReplace($filea,"|","/")
EndIf

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $Item
			$filea = FileOpenDialog("load .ini",@tempdir,".ini (*.ini)",1)
			Global $fileb = StringReplace($filea,"|","/")
			_update()
		Case $Item2
			MsgBox(0,"Help","Every time you run this prog, you need to load your vocab .ini" & @crlf & "It's build like this:" & @crlf & "[Voc]" & @crlf & "Voc=Dump/Dump" & @crlf & "Voc2=Vocabel1/Translation1" & @crlf & "Voc3=Vocabel2/Translation2" & @crlf & "..." & @crlf & @crlf & "<New Entry> sets a new entry in your loaded .ini or creates a new one, if you haven't loaded one at the start")
		Case $Item3
			MsgBox(0,"Credits","mipez: idea & scripting" & @CRLF & "(c) mipez, 2010")
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			_check()
		Case $Button2
			_list()
		Case $Button3
			_new()

	EndSwitch
WEnd

Func _new()
	$put = InputBox("Vocabel","Please set your vocabel")
	$put2 = InputBox("Vokabel","Translation")
	$vokread = IniReadSection($fileb,"Voc")
	If @error Then
		MsgBox(0,"New .ini", "A new .ini will be created, please set your vocabel/translation again")
		IniWrite($fileb,"Voc","Voc","Dump/Dump")
	Else
	IniWrite($fileb,"Voc","Voc" & $vokread[0][0]+1, $put & "/" & $put2)
	EndIf
EndFunc

Func _list()
	$hj = IniReadSection($fileb,"Voc")
	_ArrayDisplay($hj)
EndFunc



Func _update()
	$tok = IniReadSection($fileb,"Voc")
	If not @error Then
	$z =Random(2,$tok[0][0],1)
	$tak = IniRead($fileb,"Voc","Voc" & $z,"")
	$tstring = StringSplit($tak,"/")
	$z2 = Random(1,2,1)
	If $z2 = 1 Then 
		$temparray[0] = 1
	ElseIf $z2 = 2 Then 
		$temparray[0] = 2
	EndIf
	GUICtrlSetData($Label1,$tstring[$z2])
	EndIf

EndFunc

Func _check()
	$r3 = GUICtrlRead($Input1)
	$zt = FileExists($fileb)
	If NOT $zt = True Then 
		MsgBox(0,"failed to find .ini","Failed to find .ini")
	Else
		If $r3 = "" Then 
			_update()
		Else
			If $temparray[0] <> 1 Then
				If $r3 = $tstring[1] Then
					GUICtrlSetData($Label2,"Correct!")
					GUICtrlSetData($Input1,"")
					Sleep(500)
					_update()
				Else
					GUICtrlSetData($Label2,"Wrong!")
				EndIf
			ElseIf $temparray[0] <> 2 Then
				If $r3 = $tstring[2] Then
					GUICtrlSetData($Label2,"Correct!")
					GUICtrlSetData($Input1,"")
					Sleep(500)
					_update()
				Else
					GUICtrlSetData($Label2,"Wrong!")
				EndIf
			EndIf
		EndIf
	EndIf
EndFunc
Allerdings verstehe ich deine 1. Frage nicht so recht oô
Code:
IniWrite("Name.ini","Sektion","Index","Wert")
Ist noch nicht fertig, daher muss man momentan die .ini vorher erstellen:
Code:
[Voc]
Voc=Dump/Dump
Voc2=hallo/hello
Voc3=allgemein/general
Und die .ini muss im selben Verzeichnis wie das Script sein.
mipez is offline  
Reply


Similar Threads Similar Threads
Vokabeltrainer mit Autoit
11/08/2009 - AutoIt - 5 Replies
Wisst ihr wie ich mit Autoit nen Vokabeltrainer scripten kann? Sry wenn ich in der Falschen Sektion bin Dann verschieben bitte!
Vokabeltrainer
08/30/2009 - AutoIt - 8 Replies
Hi Ich hab mir nen Vokabeltrainer gebastelt. Der Haken ist nur das er halt nur das Abfragt was ich ihm vorher gesagt habe. Ich hätte es gern so das man seine Vokabel mit Übersetzung in ne Datei schreibt und er dann sich zufällig 10 von den ganzen Übersetzungen aussucht die per MsgBox dem User schreibt und man dann die eigentlich Vokabel(z.b. Fahrrad - Bike) eintippen muss. Weiß einer wie des geht bzw. kann mir da wer helfen? Grüße Baaam01



All times are GMT +1. The time now is 08:13.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.