Skip to content

Instantly share code, notes, and snippets.

@summerwxy
Created October 12, 2011 05:02
Show Gist options
  • Select an option

  • Save summerwxy/1280338 to your computer and use it in GitHub Desktop.

Select an option

Save summerwxy/1280338 to your computer and use it in GitHub Desktop.
text file parser
F2::
FileSelectFile, sfile, 3, , Pick a text file.
if sfile =
{
MsgBox, no file selected
return ; exit in this case
}
SplitPath, sfile, , sfilePath, sfileExt, sfileNoExt
if sfileExt <> txt
{
MsgBox, only for txt file
return
}
dfile = %sfilePath%/%sfileNoExt%_RESULT.txt
IfExist, %dfile%
{
MsgBox, 4, , Overwrite the existing result file: %dfile% ?
IfMsgBox, Yes
FileDelete, %dfile%
}
Loop, read, %sfile%, %dfile%
{
; rule here....
if StrLen(A_LoopReadLine) < 50
continue
IfInString, A_LoopReadLine, 000
continue
FileAppend, %A_LoopReadLine%\n
}
MsgBox, Finish...
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment