#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $text =""
Local $space_words = ""
Local $hGUI = GUICreate("Работа с текстом",700,500)
Local $myedit = GUICtrlCreateEdit ("", 0, 0,500,200, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
Local $mybutton1 = GUICtrlCreateButton ("сгенерировать текст", 0, 200,180,40)
GUISetState(@SW_SHOW, $hGUI)
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE then
ExitLoop
endif
if $msg = $mybutton1 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
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
|