#include <GUIConstantsEx.au3>
While 1
If MsgBox(33, 'Question', 'Next?') = 2 Then ExitLoop
ConsoleWrite(_MyWindow(Random(1, 4, 1)) & @LF)
WEnd
Func _MyWindow($i_Num)
Local $a_Title[4] = [3, 'Первое окно', 'Второе окно', 'Третье окно'], $h_Gui, $n_Inp, $i_W = Random(200, 400, 1), _
$i_H = Random(200, 400, 1), $s_Ret = 'Error', $s_Text
Switch $i_Num
Case 1 To 3
;OK
Case Else
Return $s_Ret
EndSwitch
For $i = 1 To 10
$s_Text &= Chr(Random(192, 255, 1))
Next
$h_Gui = GUICreate($a_Title[$i_Num], $i_W, $i_H)
$n_Inp = GUICtrlCreateInput($s_Text, Int(($i_W - 150) / 2), Int(($i_H - 20) / 2), 150, 20)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
$s_Ret = GUICtrlRead($n_Inp)
GUIDelete($h_Gui)
Return $s_Ret
EndSwitch
WEnd
EndFunc ;==>_MyWindow