#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#Region ### START Koda GUI section ### Form=D:\Form1.kxf
$Form1 = GUICreate("Form1", 623, 475, 195, 148)
$Group1 = GUICtrlCreateGroup("", 8, 80, 609, 385)
$ListView1 = GUICtrlCreateListView("内容", 16, 96, 594, 358)
_GUICtrlListView_SetColumnWidth($ListView1, 0, $LVSCW_AUTOSIZE_USEHEADER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 8, 0, 609, 65)
$Label1 = GUICtrlCreateLabel("过滤", 24, 28, 28, 17)
$Input1 = GUICtrlCreateInput("6", 56, 24, 41, 21)
;$Checkbox1 = GUICtrlCreateCheckbox("空值", 104, 26, 49, 17)
$Button1 = GUICtrlCreateButton("开始", 328, 24, 83, 25)
$Button2 = GUICtrlCreateButton("停止", 520, 24, 83, 25)
$Button3 = GUICtrlCreateButton("导出", 424, 24, 83, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$OPEN_FLIE_PATH = FileOpenDialog('打开文件', @ScriptDir & "", "所有文件 (*.*)", 1)
$STRING = FileRead($OPEN_FLIE_PATH)
$STRING_LENGTH = GUICtrlRead($Input1)
;MsgBox(0, '', ".*----.{" & $STRING_LENGTH & ",}")
$MATCH_STRING = StringRegExp($STRING, ".*----\S{" & $STRING_LENGTH & ",}", 3)
#include <Array.au3>
;_ArrayDisplay($MATCH_STRING)
;_GUICtrlListView_AddColumn($ListView1, "数据项", 100)
;_GUICtrlListView_SetItemCount($ListView1, 5)
;_GUICtrlListView_AddArray($ListView1, $MATCH_STRING)
For $i=0 To UBound($MATCH_STRING)-1
_GUICtrlListView_AddItem($ListView1, $MATCH_STRING[$i])
Next
Case $Button3
$SAVE_FILE_PATH = FileSaveDialog("保存文件", @ScriptDir & "", "所有文件 (*.*)", 2 + 16)
_FileWriteFromArray($SAVE_FILE_PATH & '.txt', $MATCH_STRING)
Exit
EndSwitch
WEnd