本帖最后由 afan 于 2012-12-1 22:50 编辑 Local $sFile = FileRead('test.txt'), $sDelimiter = '*'
Local $aLineAB = StringRegExp($sFile, '(?m)(.*?)\' & $sDelimiter & '(\V+)', 3)
If @error Then Exit MsgBox(0, '错误', '不能打开文件或文件无指定分割符')
Local $iTotal = UBound($aLineAB), $iStart = 0
HotKeySet('{esc}', '_Exit') ;按Esc键退出
HotKeySet('{f1}', '_GetData') ;按一次F1键读一次
While 1
Sleep(10000)
WEnd
Func _GetData()
MsgBox(0, ' 行 ' & ($iStart + 2) / 2, $aLineAB[$iStart] & @LF & $aLineAB[$iStart + 1])
$iStart += 2
If $iStart = $iTotal Then $iStart = 0
EndFunc ;==>_GetData
Func _Exit()
Exit
EndFunc ;==>_Exit
|