VBS implemented with support for dragging txt text cutters
Font: [Increase decrease] Type: Reprint time: 2008-06-20 I want to comment
TXT text file cutter implemented with VBS, the default is 8,000 characters segmentation to a file. Supports dragging.
Splitfile.vbs
'/*=========================================================================
' * Intro. txt text cutter, default to 8,000 characters segmentation to a file. Supports dragging.
' * FileName splitfile.vbs
' * Author yongfa365
' * Version v1.0
' * Madetime 2008-04-24 12:58:43
' * lastmodify 2008-04-24 12:58:43
' *==========================================================================*/
Set Objargs = wscript.arguments
If objargs.count = 0 Then
IIIII InputBox ("Select text file to process", "Select text file to process")
Else
For I001 = 0 to Objargs.count-1
IIIII Objargs (I001)
Next
End If
Function IIIII (Path)
TempStr = ReadFromFile (Path, "gb2312")
Length = Len (TEMPSTR)
III = 0
For II = 0 to Length step 8000 ' 8,000 characters segmentation to a file
III = III + 1
WriteToFile left (path, Len (PATH)-4) & "_" & Right ("XX" & III, 3) & ". txt", Mid (TempStr, II + 1, 8000), " gb2312 "
Next
End Function
Function ReadFromFile (FILEURL, CharSet)
Dim STR
Set stm = CreateObject ("ADODB.stream")
Stm. Type = 2
Stm.mode = 3
Stm.charset = CharSet
Stm. Open
Stm.loadfromfile FILEURL
STR = Stm.readtext
Stm. Close
Set stm = Nothing
ReadFromFile = Str
End Function
' Store files by specified encoding
Function WriteToFile (FILEURL, STR, CharSet)
Set stm = CreateObject ("ADODB.stream")
Stm. Type = 2
Stm.mode = 3
Stm.charset = CharSet
Stm. Open
Stm. WRITETEXT STR
Stm. SaveToFile FILEURL, 2
Stm.flush
Stm. Close
Set stm = Nothing
End Function
VBS implemented with support for dragging txt text cutters