TA的每日心情 | 开心 2022-3-25 16:10 |
---|
签到天数: 21 天 [LV.4]偶尔看看III
中级会员
- 积分
- 2341
|
'保存为.vbs
'字幕文件自动更名
'注:目录下不能有其他.mkv文件
'字幕文件和视频文件放在同意目录下
dim ass_chs_num,ass_cht_num
dim shuan_ass
shuan_ass="F"
dim lovelive
dim ass_file_num,mkv_file_num
dim ad
dim ass(1000),mkv(1000),ass_chs(1000),ass_cht(1000)
ass_file_num=0
mkv_file_num=0
Set fso = CreateObject("Scripting.FileSystemObject")
lovelive=inputbox("设置文件夹路径",,"LL大法")
if lovelive=Flase or lovelive="LL大法" then
wscript.quit
end if
If not FSO.FolderExists(lovelive) Then
msgbox "文件夹不存在"
wscript.quit
end if
Set Folder = FSO.GetFolder(lovelive)
Set Files = Folder.Files
ad=len(Folder)+1
For Each F In Files
if right(F,3)="ass" then
ass(ass_file_num)=F
ass_file_num=ass_file_num+1
else if right(F,3)="mkv" then
mkv(mkv_file_num)=F
mkv_file_num=mkv_file_num+1 '20
end if
end if
Next
if ass_file_num=0 or mkv_file_num=0 then
msgbox ("无字幕文件或无视频文件")
wscript.quit
else
mkv_file_num=mkv_file_num-1
ass_file_num=ass_file_num-1
call k_on
end if
sub k_on()
'mkv文件名提取
dim slong
dim nmkv
for i=0 to mkv_file_num
nmkv=right(mkv(i),len(mkv(i))-ad)
slong=len(nmkv)-4
nmkv=left(nmkv,slong)
mkv(i)=nmkv
next
ass_chs_num=0
ass_cht_num=0 '
for i=0 to ass_file_num '双字幕相关
if right(ass(i),6)="tc.ass" then
ass_chs(ass_chs_num)=ass(i)
ass_chs_num=ass_chs_num+1
shuan_ass="true"
else if right(ass(i),6)="sc.ass" then
ass_cht(ass_cht_num)=ass(i)
ass_cht_num=ass_cht_num+1
end if
end if
next
ass_chs_num=ass_chs_num-1
ass_cht_num=ass_cht_num-1
end sub
if mkv_file_num=ass_file_num or mkv_file_num=ass_chs_num then
call rename_
else
' msgbox mkv_file_num
' msgbox ass_chs_num
' msgbox ass_file_num
msgbox ("文件数量不匹配")
end if
sub rename_()
if shuan_ass="true" then
for i=0 to ass_chs_num
set filep=fso.getfile(ass_chs(i))
filep.name=mkv(i)+".tc.ass"
next
for i=0 to ass_cht_num
set filep=fso.getfile(ass_cht(i))
filep.name=mkv(i)+".sc.ass"
next
else
for i=0 to ass_file_num
set filep=fso.getfile(ass(i))
filep.name=mkv(i)+".ass"
next
end if
end sub |
评分
-
查看全部评分
|