下面是使用AutoHotkey编写的脚本,可以实现你要求的功能:

#NoEnv
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2

; 打开文件
FileRead, fileContent, D:\桌面\123\subtitles.txt

; 查找第一行和第二行带有时间码的内容
firstLine := ""
secondLine := ""
Loop, Parse, fileContent, `n
{
    currentLine := Trim(A_LoopField)
    if (RegExMatch(currentLine, "^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}"))
    {
        if (firstLine = "")
        {
            firstLine := currentLine
        }
        else if (secondLine = "")
        {
            secondLine := currentLine
            break
        }
    }
}

; 显示结果
MsgBox, 第一行: %firstLine%`n第二行: %secondLine%

将上述代码保存为一个.ahk文件,然后双击运行即可。请确保文件路径D:\桌面\123\subtitles.txt正确,否则需要根据实际情况进行修改。脚本会读取文件内容,查找第一行和第二行带有时间码的内容,并将结果显示在一个消息框中

用autohotkey编写一个脚本。打开D桌面123subtitlestxt文件找出里面带有时间码的第一行和带有时间码的第二行并显示出来

原文地址: https://www.cveoy.top/t/topic/hyjM 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录