#Region ************ Includes ************
#Include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <file.au3>
#EndRegion ************ Includes ************
Global $file = "s.txt"
Global $Num = 0
Global $SlovoInHeb = "Поучимся?"
Global $Otvet = "Начать"
Global $1Checkbox = "Учись"
Global $2Checkbox = "Учись"
Global $3Checkbox = "Учись"
Global $4Checkbox = "Учись"
Global $5Checkbox = "Учись"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Hebrew Teacher", 389, 292, -1, -1)
$Label1 = GUICtrlCreateLabel($SlovoInHeb, 4, 28, 370, 53,$SS_CENTER)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Spisok = GUICtrlCreateCombo("На выбор", 0, 0, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Существительные ")
$Group1 = GUICtrlCreateGroup("Варианты ответа:", 4, 92, 165, 137)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox($1Checkbox, 12, 120, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox($2Checkbox, 12, 140, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox($3Checkbox, 12, 160, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox($4Checkbox, 12, 180, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox($5Checkbox, 12, 200, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Статистика", 172, 92, 205, 77)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Правельных ответов:", 180, 120, 113, 17)
$Label3 = GUICtrlCreateLabel("Не правельных ответов :", 180, 144, 131, 17)
$Label4 = GUICtrlCreateLabel("0", 320, 120, 42, 17)
$Label5 = GUICtrlCreateLabel("0", 320, 144, 42, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton($Otvet, 172, 172, 207, 57)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Результат", 4, 236, 374, 41,$SS_CENTER)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$hFile = FileOpen(@ScriptDir & '\s.txt', 0)
If $hFile = -1 Then
MsgBox(4096, "Ошибка", "Невозможно открыть файл.")
Exit
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Start()
$Otvet = "Проверить ответ"
GUICtrlSetData($Button1,$Otvet)
EndSwitch
WEnd
Func Start()
read()
Dim $ONum1 = 0
Dim $ONum2 = 0
Dim $ONum3 = 0
Dim $ONum4 = 0
Dim $ONum5 = 0
$Num = Random(1,_FileCountLines($file),1)
If Mod($Num,2) =0 Then
$ONum1 = Random(1,_FileCountLines($file),1)
If Mod($ONum1,2) =0 Then
GUICtrlRead($ONum1)
$1Checkbox = FileReadLine(@ScriptDir & '\s.txt',$ONum1)
GUICtrlRead($1Checkbox)
GUICtrlSetData($Checkbox1,$1Checkbox)
IniWrite("Data.ini","Data","1Checkbox",$1Checkbox)
EndIf
$ONum2 = Random(1,_FileCountLines($file),1)
If Mod($ONum2,2) =0 Then
GUICtrlRead($ONum2)
$2Checkbox = FileReadLine(@ScriptDir & '\s.txt',$ONum2)
GUICtrlRead($2Checkbox)
GUICtrlSetData($Checkbox2,$2Checkbox)
IniWrite("Data.ini","Data","2Checkbox",$2Checkbox)
EndIf
$ONum3 = Random(1,_FileCountLines($file),1)
If Mod($ONum3,2) =0 Then
GUICtrlRead($ONum3)
$3Checkbox = FileReadLine(@ScriptDir & '\s.txt',$ONum3)
GUICtrlRead($3Checkbox)
GUICtrlSetData($Checkbox3,$3Checkbox)
IniWrite("Data.ini","Data","3Checkbox",$3Checkbox)
EndIf
$ONum4 = Random(1,_FileCountLines($file),1)
If Mod($ONum4,2) =0 Then
GUICtrlRead($ONum4)
$4Checkbox = FileReadLine(@ScriptDir & '\s.txt',$ONum4)
GUICtrlRead($4Checkbox)
GUICtrlSetData($Checkbox4,$4Checkbox)
IniWrite("Data.ini","Data","4Checkbox",$4Checkbox)
EndIf
$ONum5 = Random(1,_FileCountLines($file),1)
If Mod($ONum5,2) =0 Then
GUICtrlRead($ONum5)
$5Checkbox = FileReadLine(@ScriptDir & '\s.txt',$ONum5)
GUICtrlRead($5Checkbox)
GUICtrlSetData($Checkbox5,$5Checkbox)
IniWrite("Data.ini","Data","5Checkbox",$5Checkbox)
EndIf
Else
GUICtrlRead($Num)
$SlovoInHeb = FileReadLine(@ScriptDir & '\s.txt',$Num)
GUICtrlSetData($Label1, $SlovoInHeb)
IniWrite("Data.ini","Data","Slovo",$SlovoInHeb)
EndIf
EndFunc
Func Read()
$1Checkbox = IniRead("Data.ini","Data","1Checkbox","Учись")
$2Checkbox = IniRead("Data.ini","Data","2Checkbox","Учись")
$3Checkbox = IniRead("Data.ini","Data","3Checkbox","Учись")
$4Checkbox = IniRead("Data.ini","Data","4Checkbox","Учись")
$5Checkbox = IniRead("Data.ini","Data","5Checkbox","Учись")
$SlovoInHeb = IniRead("Data.ini","Data","Slovo","Поучимся?")
GUICtrlSetData($Checkbox1,$1Checkbox)
GUICtrlSetData($Checkbox2,$2Checkbox)
GUICtrlSetData($Checkbox3,$3Checkbox)
GUICtrlSetData($Checkbox4,$4Checkbox)
GUICtrlSetData($Checkbox5,$5Checkbox)
GUICtrlSetData($Label1, $SlovoInHeb)
EndFunc