#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, "английский")
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 10
$space_words &= generate_word(10) &" "
next
endif
if $id = 1 then
for $i = 0 to 10
$space_words &= generate_en_word(10) &" "
next
endif
if $id = 2 then
for $z = 0 to 5
$space_words &= generate_word(random(2,15,1))
$space_words &= generate_en_word(random(2,15,1))
$space_words &= " "
next
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_word($len)
$vowels ="aeiou"
$consonants = "bcdfghjklmnpqrstvwzyz"
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
|