#include <file.au3>
#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Files="1.txt"
$GUI = GUICreate("", 423, 254, 193, 115)
$Edit = GUICtrlCreateEdit("", 8, 8, 401, 201)
$OK = GUICtrlCreateButton("编辑", 8, 216, 75, 25, 0)
Readdate()
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $OK
Setdate()
EndSwitch
WEnd
Func Readdate()
Dim $aRecords
If Not _FileReadToArray($Files, $aRecords) Then
MsgBox(4096, "错误", "无法打开文件!", 2)
Exit
EndIf
For $x = 1 To $aRecords[0]
GUICtrlSetData($Edit, $aRecords[$x] & @CRLF, $x)
Next
EndFunc ;==>readdate
Func Setdate()
$Max = _GUICtrlEdit_GetLineCount($Edit)
For $y = 1 To $Max
$txt = _GUICtrlEdit_GetLine($Edit, $y)
_FileWriteToLine($Files, $y, $txt, 1)
Next
EndFunc ;==>Setdate
|