热键 + 快进
热键 - 快退
热键 Esc 退出
1000 延时的增量(毫秒)
;#include <Array.au3>
HotKeySet('{NUMPADADD}', 'kj') ;注册热键 + 快进
HotKeySet('{NUMPADSUB}', 'kt') ;注册热键 - 快退
HotKeySet('{Esc}', '_exit') ;注册热键 Esc 退出
Dim $zl = 1000 ;延时的增量(毫秒)
Dim $t = 0, $exit = 0
Dim $lrc = '连贝多芬都想告诉你.lrc'
Local $str = FileRead($lrc)
Local $sR = StringRegExp($str, '\[\d\d:\d\d\.\d\d\]', 3)
_ArraySort($sR)
Local $txt = '', $i, $_time, $t_lrc
$begin = TimerInit()
For $i = 0 To UBound($sR) - 1
$_time = StringRegExpReplace($sR[$i], '(\[|\])', '\\$1')
$txt = StringRegExpReplace($str, '(?s).+?' & $_time & '(?:\[[^\]]+\])*([^\r]*).+', '$1')
While 1
Sleep(10)
If $exit Then ExitLoop 2 ;esc按键已按下退出
$t_lrc = Execute(StringRegExpReplace($sR[$i], '\[(\d\d):(\d\d)\.(\d\d)\]', '$1*60*1000+$2*1000+$3*10'))
If Round(TimerDiff($begin)) >= ($t_lrc + $t) Then
ToolTip($txt, 0, 0) ;这里的$txt即需要的文本变量,输出只需改动此行。
ExitLoop
EndIf
WEnd
Next
Func kj()
$t -= $zl
EndFunc ;==>kj
Func kt()
$t += $zl
EndFunc ;==>kt
Func _exit()
$exit = 1
EndFunc ;==>_exit
|