#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Word.au3>
#include <Encoding.au3>
;
HotKeySet("{TAB}", "ShowMessage")
GUICreate("IC - ", 420, 550, (@DesktopWidth - 469) / 2, (@DesktopHeight - 639) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$TEXT = GUICtrlCreateEdit("", 105, 10, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT1 = GUICtrlCreateEdit("", 105, 40, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT2 = GUICtrlCreateEdit("", 105, 70, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT3 = GUICtrlCreateEdit("", 105, 100, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT4 = GUICtrlCreateEdit("", 105, 130, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT5 = GUICtrlCreateEdit("", 105, 160, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT6 = GUICtrlCreateEdit("", 105, 190, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT7 = GUICtrlCreateEdit("", 105, 220, 300, 20, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$TEXT10 = GUICtrlCreateEdit("", 10, 290, 300, 200, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
$BTNPREVIEW = GUICtrlCreateButton("&Просмотр", 305, 245, 100)
GUICtrlSetTip(-1, "Show the MessageBox")
$BTNCOPY = GUICtrlCreateButton("&Copy", 120, 510, 100)
GUICtrlSetTip(-1, "Copy the generated AutoIt code to the Clipboard")
$BTNEXIT = GUICtrlCreateButton("&Закрыть", 230, 510, 100)
GUICtrlSetTip(-1, "Quit the program")
GUISetState()
$sData = "--------------------------------------------------------------------------------------------" & @CRLF
$sData &= " ФАМИЛИЯ: %s" & @CRLF
$sData &= " ИМЯ: %s" & @CRLF
$sData &= " ОТЧЕСТВО: %s" & @CRLF
$sData &= " ДАТА РОЖДЕНИЯ: %s" & @CRLF
$sData &= "МЕСТО РОЖДЕНИЯ: %s" & @CRLF
$sData &= " ЦЕЛЬ ПРОВЕРКИ: %s" & @CRLF
$sData &= "--------------------------------------------------------------------------------------------" & @CRLF
$sData &= " ПОДПИСАЛ: %s" & @CRLF
$sData &= " ИСПОЛНИТЕЛЬ: %s" & @CRLF
While 1
$MSG = GUIGetMsg()
Select
Case $MSG = $GUI_EVENT_CLOSE Or $MSG = $BTNEXIT
Exit
Case $MSG = $BTNPREVIEW
$sPrewview = StringFormat($sData, _
GUICtrlRead($TEXT), GUICtrlRead($TEXT1), GUICtrlRead($TEXT2), _
GUICtrlRead($TEXT4), GUICtrlRead($TEXT3), GUICtrlRead($TEXT5), GUICtrlRead($TEXT6), GUICtrlRead($TEXT7))
GUICtrlSetData($TEXT10, $sPrewview)
Case $MSG = $BTNCOPY
MsgBox(4096, "Уведомление", "Данные сохранены в файл.", 4)
;MsgBox(0, '', "Текст в ANSI: " & $sData & @CRLF & "Текст в OEM : " & $s)
EndSelect
WEnd
Func ShowMessage()
$file = FileOpen("IC1.txt", 1)
; Check if file opened for writing OK
If $file = -1 Then
Beep(1)
MsgBox(0, "Ошибка", "Закройте файл.")
Return
EndIf
MsgBox(4096, "Уведомление", "Данные сохранены в файл.", 4)
FileWrite($file, "" & @CRLF)
FileWrite($file, " ---------------------------------------------- " & @CRLF)
FileWrite($file, " ФАМИЛИЯ: " & _StringANSI2OEM(GUICtrlRead($TEXT)) & @CRLF)
FileWrite($file, " ИМЯ: " & _StringANSI2OEM(GUICtrlRead($TEXT1)) & @CRLF)
FileWrite($file, " ОТЧЕСТВО: " & _StringANSI2OEM(GUICtrlRead($TEXT2)) & @CRLF)
FileWrite($file, " ДАТА РОЖДЕНИЯ: " & _StringANSI2OEM(GUICtrlRead($TEXT3)) & @CRLF)
FileWrite($file, " МЕСТО РОЖДЕНИЯ: " & _StringANSI2OEM(GUICtrlRead($TEXT4)) & @CRLF)
FileWrite($file, " ЦЕЛЬ ПРОВЕРКИ: " & _StringANSI2OEM(GUICtrlRead($TEXT5)) & @CRLF)
;$datekal не существует
;FileWrite($file, " ДАТА: " & GUICtrlRead($datekal) & @CRLF)
FileWrite($file, " ---------------------------------------------- " & @CRLF)
FileWrite($file, " ПОДПИСАЛ: " & _StringANSI2OEM(GUICtrlRead($TEXT6)) & @CRLF)
FileWrite($file, " ИСПОЛНИТЕЛЬ: " & _StringANSI2OEM(GUICtrlRead($TEXT7)) & @CRLF)
FileClose($file)
EndFunc ;==>ShowMessage