该脚本源自https://exp.newsmth.net/topic/article/5e884d8c54532a0f5e7006a4adc81c1c
在实际使用情况下,不能将缩略图放置在相应的位置,且无法自动关闭。3.21
bug原因已找到,猜测可能是版本更新源于 WinWaitActive, ahk_class #32770,,3 无法定位到相应位置,更改为send {TAB} 解决
/*
配合PotPlayer使用的批量制作视频缩略图软件
@author: Alwaysmylove <http://blog.alwaysmylove.net>
@version: 1.0
*/
SetBatchLines, -1
FileSelectFolder,MovieDir,,0,请选择要处理的文件夹
ifNotExist %MovieDir%
{
MsgBox 要处理的文件夹 “%MovieDir%” 不存在
ExitApp
}
FileSelectFile,PotPlayer,3,,请选择PotPlayer执行文件,PotPlayer文件 (PotPlayerMini64.exe)
ifNotExist %PotPlayer%
{
MsgBox PotPlayer执行文件 “%PotPlayer%” 不存在
ExitApp
}
PreviewDir = %MovieDir%\Preview
ifNotExist %PreviewDir%
FileCreateDir, %PreviewDir%
MovieFileCount = 0
oldClip = %Clipboard%
SetTitleMatchMode 2
SetTitleMatchMode Fast
Loop, %MovieDir%\*.*, , 1
{
if A_LoopFileDir = %PreviewDir%
continue
StringLower FileExt, A_LoopFileExt
if FileExt in avi,mov,rmvb,mpg,wmv,rm,asf,dat,mpeg,ogg,mkv,mp4,3gp,flv,ts
{
SplitPath, A_LoopFileFullPath, , , , name_no_ext,
ifExist, %PreviewDir%\%name_no_ext%.jpg
continue
OutputDebug,处理 %A_LoopFileFullPath% 中
Run,%PotPlayer% “%A_LoopFileFullPath%”
WinWait, %A_LoopFileName%, , 10
WinActivate
clipboard = %PreviewDir%\%name_no_ext%.jpg
ClipWait
Send !n
WinWaitActive, ahk_class #32770,,3
Send ^v
Send {Enter}
Loop 300 {//300循环
Sleep 1000
ifExist, %PreviewDir%\%name_no_ext%.jpg//存在缩略图,退出循环
break
ifWinNotExist, %A_LoopFileName%
{
break
}
}
WinKill,,,3
MsgBox %A_LoopFileName%窗口已关闭
MovieFileCount ++
}
WinKill,,,3
}
Clipboard = %oldClip%
MsgBox 一共截取了%MovieFileCount%个视频文件
return