级别: 新手上路
- 注册时间:
- 2005-01-12
- 在线时间:
- 0小时
- 发帖:
- 15
|
由于看不惯subresync.exe转的SRT坐标乱伦 所以花了N小时搞定了这个 使用方法: 把下边的代码用记事本保存为.wsf 把要转换的ASS或SSA文件拖上来就是了 相对于subresync.exe的优点: 1,转换后保留{\pos(x,y)} 2,转换后保留Style Default 相对于subresync.exe的缺点 1,没有GUI 2,还有很多,等待你的弥补 3,... 4,... 注:输入输出文件均为utf-8 若要修改输入输出的为其他 用记事本打开,在3,4行找到 cInput和cOutput, 改成你想要的,如unicode,gb2312,big5 以及HKEY_CLASSES_ROOT\MIME\Database\Charset下的一切编码 - cInput="utf-8"; // You can find them from:
- cOutput="utf-8";// HKEY_CLASSES_ROOT\MIME\Database\Charset
- function rrr(){
- re = /Dialogue: [^,.]*[0-9]*,([1-9]?[0-9]*:[0-9]*:[0-9]*.[0-9]*),([1-9]?[0-9]*:[0-9]*:[0-9]*.[0-9]*),[^,.]*,[^,.]*,[0-9]*,[0-9]*,[0-9]*,[^,.]*,(.*)/gi;
- rv = ss.match(re);
- t1 = RegExp.$1;
- t2 = RegExp.$2;
- t3 = RegExp.$3;
- rg = /\{[^}.]*(\\pos\([0-9]*,[0-9]*\))[^}.]*}/gi;
- t3 = t3.replace(rg,"$1" + "}");
- rg =/\{[^}.]*}/gi;
- t3 = t3.replace(rg,"");
- rg =/(\\pos\([0-9]*,[0-9]*\)})/gi;
- t3 = t3.replace(rg,"{" + "$1");
- }
- set ad=CreateObject("adodb.stream")
- set af=CreateObject("adodb.stream")
- set ass=CreateObject("adodb.stream")
- ad.open
- af.open
- ass.open
- ad.Charset=cInput
- af.Charset=cOutput
- ass.Charset=cOutput
- Set objArgs = WScript.Arguments
- For I = 0 to objArgs.Count - 1
- ad.LoadFromFile(objArgs(I))
- z=0
- gg=left(objArgs(I),len(objArgs(I))-3)&"srt"
- Do While ad.eos <> True
- ss =ad.ReadText(-2)
- if left(ss,8)="Dialogue" then
- ss=replace(ss,",,",",d,")
- rrr
- t3=replace(t3,"\n",vbcrlf)
- t3=replace(t3,"\N",vbcrlf)
- z=z+1
- af.writetext z,1
- af.writetext t1 & " --> " & t2,1
- af.writetext t3 & vbcrlf & vbcrlf
- else
- ass.writetext ss,1
- end if
- Loop
- af.savetofile gg,2
- ass.savetofile gg&".style",2
- Next
- if i=0 then
- msgbox "Please drag files to me!",,"Error!"
- else
- msgbox "Converted "&i&" file(s).",,"All Over!"
- end if
如果不行,请去 http://bbs.ktxp.com/read.php?tid=92214&page=e#a
|