#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
Local $space_words = ""
Local $hGUI = GUICreate("Работа с текстом",700,500)
Local $myedit = GUICtrlCreateEdit ("", 0, 0,500,200, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
Local $idComboBox = GUICtrlCreateCombo("русский", 0, 220, 185, 20)
GUICtrlSetData($idComboBox, "английский")
Local $mybutton1 = GUICtrlCreateButton ("сгенерировать текст", 0, 250,180,40)
GUISetState(@SW_SHOW, $hGUI)
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE then
ExitLoop
endif
if $msg = $mybutton1 then
Local $id = _GUICtrlComboBox_GetCurSel($idComboBox)
if $id = 0 then
for $i = 0 to 20
Local $r = random(0,2,1)
if $r = 0 then
$space_words &= generate_word(random(3,6,1)) & " "
elseif $r = 1 then
$space_words &= generate_word(random(6,10,1)) & " "
elseif $r = 2 then
$space_words &= generate_word(random(2,5,1)) & " "
endif
next
endif
if $id = 1 then
generate_en_text()
endif
GUICtrlSetData($myedit,$space_words)
endif
Wend
func generate_word($len)
$vowels ="аеёиоуыэюя"
$consonants = "бвгджзйклмнпрстфхцчшщъь"
Local $word = ""
for $i = 0 to $len
$select = Random(0,1,1)
if ($select = 0) then
$a = Random(0,StringLen($vowels))
$word = $word & StringMid($vowels,$a,1 )
else
$b = Random(0,StringLen($consonants))
$word = $word & StringMid($consonants,$b,1 )
endif
next
return $word
EndFunc
Func generate_en_text()
Local $text = ""
for $z = 0 to 250
$text &= Chr(Random(65, 91, 1))
Next
for $z = 0 to 250
$r = Random(5,15,1)
for $i = 0 to $r
$space_words &= StringMid($text,$z+$i,1)
next
$space_words &= StringMid($text,$z+$i,1) & " "
Next
$space_words =StringLower($space_words)
EndFunc
|