因此暑假闲暇编写了这个简短精悍的脚本版的分割器。脚本版的最大的好处可以由使用者进行DIY。
具体情况就不多说了,关于txt编码的问题可以参考,iPod文本分割器
这里仅仅说明使用方法,将您需要分割的Txt文件直接拖放发到本脚本上就ok了。
以下是脚本代码,直接复制后保存为vbs文件就可以了!
Good Luck !
复制代码 代码如下:
'------------------------------------------------------------
' 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

标签:
iPod,文本分割器

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
评论“iPod文本分割器(VBS版)”
暂无“iPod文本分割器(VBS版)”评论...

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。