主頁 > 知識庫 > iPod文本分割器(VBS版)

iPod文本分割器(VBS版)

熱門標(biāo)簽:新密防封卡外呼系統(tǒng)違法嗎 辦理膠州400電話財(cái)稅 陜西高頻外呼回?fù)芟到y(tǒng)哪家好 加盟電銷機(jī)器人好的品牌 海外美發(fā)店地圖標(biāo)注 前鋒辦理400電話申請 外呼營銷下單系統(tǒng) 百度地圖標(biāo)注怎么卸載 打電話的外呼系統(tǒng)貴不貴

因此暑假閑暇編寫了這個簡短精悍的腳本版的分割器。腳本版的最大的好處可以由使用者進(jìn)行DIY。
具體情況就不多說了,關(guān)于txt編碼的問題可以參考,iPod文本分割器
這里僅僅說明使用方法,將您需要分割的Txt文件直接拖放發(fā)到本腳本上就ok了。
以下是腳本代碼,直接復(fù)制后保存為vbs文件就可以了!
Good Luck !

復(fù)制代碼 代碼如下:

'------------------------------------------------------------
' Description : Text division for iPod text reading.
' because of iPod can not display text length
' more than 4KB in each file, we have to split
' the bigger one.
' And iPod intrenal use Unicode, so this script
' can also tranfrom the character coding.
' Author : Guoyafeng@jspi.edu.cn
' Last Modified : 2008-8-31 11:05:13
'------------------------------------------------------------
Option Explicit
Sub OpenDir(Dir)
Dim WShell,CmdString
Set WShell = CreateObject("WScript.Shell")
CmdString = "Explorer.exe " Dir
WShell.Run CmdString,1,True
End Sub
Function FormatStrNum(iNum)
Const Mode = "0000"
Dim sNum
sNum = CStr(iNum)
FormatStrNum = Left(Mode,Len(Mode)-Len(sNum)) sNum
End Function
Function IIf(test,a,b)
If test = True Then IIf = a Else IIf = b
End Function
Function GetDragDropFile
If WScript.Arguments.Count = 0 Then MsgBox "請把需要分割的Txt文件拖放到本腳本上!"
WScript.Quit
Else
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(WScript.Arguments(0))) Then
GetDragDropFile = WScript.Arguments(0)
Set fso = Nothing
Else
Set fso = Nothing
MsgBox "無法找到文件" WScript.Arguments(0)
WScript.Quit
End If
End If
End Function
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateTrue = -1
Const TristateUseDefault=-2
Const TristateFalse=0
Dim ToWrite
Dim Index
Dim fso
Dim src
Dim dst
Dim TextSize
Dim MaxTextLength
Dim SourceFile
Dim DestinationFile
Dim BaseName
Dim OutFolderPath
Dim IsUnicode
Dim regEx,patrn
'***************************************************************
' Splited text size .
TextSize = 4 'KB
IsUnicode = True
'*****************************************************************
MaxTextLength = 1024 * TextSize / 2 - 1
patrn = "(\r\n\r\n)+|( +)"
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True

Set fso = CreateObject("Scripting.FileSystemObject")
BaseName = fso.GetBaseName(GetDragDropFile)
OutFolderPath = fso.BuildPath(fso.GetParentFolderName(GetDragDropFile),_
BaseName)
Set src = fso.OpenTextFile(GetDragDropFile, ForReading,False,_
TristateUseDefault)
If Not fso.FolderExists(OutFolderPath) Then
fso.CreateFolder OutFolderPath
End If
Index = 1
While(src.AtEndOfStream > True)
ToWrite = src.Read(MaxTextLength)
DestinationFile = fso.BuildPath(OutFolderPath,BaseName _
FormatStrNum(Index) ".txt")
Set dst=fso.OpenTextFile(DestinationFile,ForWriting,True,IIf(IsUnicode,TristateTrue,TristateUseDefault))
Dim SlimText
SlimText = regEx.Replace(ToWrite,"")
dst.Write SlimText
dst.Close
Set dst = Nothing
Index = Index + 1
Wend
src.Close
Set src = Nothing
Set fso = Nothing
Set regEx = Nothing
OpenDir OutFolderPath

標(biāo)簽:阜陽 咸陽 河南 牡丹江 伊春 四平 武威 梅州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《iPod文本分割器(VBS版)》,本文關(guān)鍵詞  iPod,文本,分割,器,VBS,版,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《iPod文本分割器(VBS版)》相關(guān)的同類信息!
  • 本頁收集關(guān)于iPod文本分割器(VBS版)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章