#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <FileConstants.au3>
Local $hGUI1 = GUICreate("Gui 1",500,500)
Local $idedit = GUICtrlCreateEdit("", 0, 0,500,300, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL))
Local $idMenu1 = GUICtrlCreateMenu("Работа с формами")
Local $idCreateForm = GUICtrlCreateMenuItem("Создать форму", $idMenu1)
Local $idEndForm = GUICtrlCreateMenuItem("Закрыть форму", $idMenu1)
Local $idCheckBox = GUICtrlCreateMenuItem("Создать флажок", $idMenu1)
Local $idRadio = GUICtrlCreateMenuItem("Создать переключатель", $idMenu1)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idCreateForm
gui2()
Case $idEndForm
Local $htmlcode = GUICtrlRead($idedit)
$htmlcode &= @CRLF & "</form>"
GUICtrlSetData($idedit,$htmlcode)
Case $idCheckBox
gui3()
Case $idRadio
gui4()
EndSwitch
WEnd
Func gui2()
Local $hGUI2 = GUICreate("Свойства формы", 350, 350)
GUICtrlCreateLabel("Имя формы",0,0)
Local $idInput_1 = GUICtrlCreateInput("",0,25,200)
GUICtrlCreateLabel("Имя обработчика",0,50)
Local $idInput_2 = GUICtrlCreateInput("",0,75,200)
GUICtrlCreateLabel("Идентификатор",0,100)
Local $idInput_3 = GUICtrlCreateInput("",0,125,200)
GUICtrlCreateLabel("Метод",0,150)
Local $idComboBox_1 = GUICtrlCreateCombo("",0,175,200)
GUICtrlSetData($idComboBox_1, "get|post")
GUICtrlCreateLabel("Способ кодирования",0,200)
Local $idComboBox_2 = GUICtrlCreateCombo("",0,225,200)
GUICtrlSetData($idComboBox_2, "text/plain|multipart/form-data|application/x-www-form-urlencoded")
Local $idComplete = GUICtrlCreateButton("Создать форму",0,275,200)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($hGUI2)
ExitLoop
Case $idComplete
Local $nameform = GUICtrlRead($idInput_1)
Local $scriptname = GUICtrlRead($idInput_2)
Local $idform = GUICtrlRead($idInput_3)
Local $methodform = GUICtrlRead($idComboBox_1)
Local $enctypeform = GUICtrlRead($idComboBox_2)
Local $q = """"
Local $HtmlCode = " <form " & _
" action= " & $q & $scriptname & $q & _
" enctype= " & $q & $enctypeform & $q & _
" id= " & $q & $idform & $q & _
" method= " & $q & $methodform & $q & _
" name= " & $q & $nameform & $q & " > "
Local $hFileOpen = FileOpen("form.txt",$FO_OVERWRITE)
FileWriteLine($hFileOpen,$HtmlCode)
FileClose($hFileOpen)
Local $hFileOpen = FileOpen("form.txt",$FO_READ)
Local $sFileRead = FileReadLine($hFileOpen, 1)
FileClose($hFileOpen)
GUICtrlSetData($idedit,$sFileRead)
GUIDelete($hGUI2)
ExitLoop
EndSwitch
WEnd
EndFunc
Func gui3()
Local $hGUI3 = GUICreate("Свойства флажка", 350, 350)
GUICtrlCreateLabel("Имя флажка",0,0)
Local $idInput_1 = GUICtrlCreateInput("",0,25,200)
GUICtrlCreateLabel("Значение",0,50)
Local $idInput_2 = GUICtrlCreateInput("",0,75,200)
GUICtrlCreateLabel("Пометка флажка",0,100)
Local $idComboBox_1 = GUICtrlCreateCombo("",0,125,200)
GUICtrlSetData($idComboBox_1, "checked")
Local $idComplete = GUICtrlCreateButton("Добавить флажок",0,150,200)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($hGUI3)
ExitLoop
Case $idComplete
Local $namecheckbox = GUICtrlRead($idInput_1)
Local $valuecheckbox = GUICtrlRead($idInput_2)
Local $checked = GUICtrlRead($idComboBox_1)
Local $q = """"
Local $htmlcode = GUICtrlRead($idedit)
$htmlcode &= @CRLF & "<input " & "type=" &$q & "checkbox" & $q & _
" name= " & $q & $namecheckbox & $q & _
" value= " & $q & $valuecheckbox & $q & _
" checked= " & $q & $checked & $q & " >"
GUICtrlSetData($idedit,$htmlcode)
GUIDelete($hGUI3)
ExitLoop
EndSwitch
WEnd
EndFunc
Func gui4()
Local $hGUI4 = GUICreate("Свойства переключателя", 350, 350)
GUICtrlCreateLabel("Имя",0,0)
Local $idInput_1 = GUICtrlCreateInput("",0,25,200)
GUICtrlCreateLabel("Значение",0,50)
Local $idInput_2 = GUICtrlCreateInput("",0,75,200)
GUICtrlCreateLabel("Пометка переключателя",0,100)
Local $idComboBox_1 = GUICtrlCreateCombo("",0,125,200)
GUICtrlSetData($idComboBox_1, "checked")
Local $idComplete = GUICtrlCreateButton("Добавить переключатель",0,150,200)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($hGUI4)
ExitLoop
Case $idComplete
Local $nameradio = GUICtrlRead($idInput_1)
Local $valueradio = GUICtrlRead($idInput_2)
Local $checked = GUICtrlRead($idComboBox_1)
Local $q = """"
Local $htmlcode = GUICtrlRead($idedit)
$htmlcode &= @CRLF & "<input " & "type=" &$q & "radio" & $q & _
" name= " & $q & $nameradio & $q & _
" value= " & $q & $valueradio & $q & _
" checked= " & $q & $checked & $q & " >"
GUICtrlSetData($idedit,$htmlcode)
GUIDelete($hGUI4)
ExitLoop
EndSwitch
WEnd
EndFunc
|