How to implement vbs txt text Cutter supporting dragging
This article mainly introduces how to achieve vbs to support drag txt text cutter, the article is very detailed, has a certain reference value, interested friends must read it!
The'/ * ='* Intro .txt text cutter defaults to 8000 characters and cuts to one file. Dragging is supported. '* FileName SplitFile.vbs' * Version v1.0'* = * / 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 '8000 characters cut into a file iii = iii + 1 WriteToFile Left (Path, Len (Path)-4) & "_" & Right ("00" & 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 the file Function WriteToFile (FileUrl, Str) in the specified encoding 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 and above are all the contents of the article "how vbs implements a txt text Cutter that supports dragging" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!