本帖最后由 C.L 于 2010-4-7 23:07 编辑
需要有些时间不知道是怎么回事,我去除了我不懂的,选懂的做了一个,挺好玩的,呵呵~~
我没写到文件里,建了个GUI的EDIT来显示,用的是事件模式,是为了可以随时结束,不被循环影响,时间为了看着快点,我调快了5倍,歌词前我加上了显示的时间,方便看,代码贴上来:#include <GUIConstantsEx.au3>
#include <GUIConstantsEx.au3>
$str = _
'[ti:连贝多芬都想告诉你]' & @CRLF & _
'[ar:萧闳仁]' & @CRLF & _
'[al:萧闳仁]' & @CRLF & _
'[by:李泽昊]' & @CRLF & _
'[04:28.00][00:02.00]萧闳仁 - 连贝多芬都想告诉你' & @CRLF & _
'[04:13.00][00:21.00]www.51lrc.com ▓ 李泽昊' & @CRLF & _
'[00:40.00]歌词吾爱 带你心飞' & @CRLF & _
'[05:38.15][05:09.67][04:43.00][04:11.49][03:44.40][03:19.17][02:43.34][02:16.00][01:50.80][01:25.55][00:59.00]' & @CRLF & _
'[01:01.51]我的抽屉 沾满灰尘' & @CRLF & _
'[01:07.50]有多久没整理' & @CRLF & _
'[01:13.69]浓浓哀伤在叹息' & @CRLF & _
'[01:19.91]我拿起了笔 写了古典' & @CRLF & _
'[02:54.71][01:26.71]第一乐章 我想告诉你' & @CRLF & _
'[03:00.84][01:32.37]我快要听不清楚' & @CRLF & _
'[03:07.32][01:38.52]非得要像休止符' & @CRLF & _
'[03:13.72][01:45.59]黑不拉几要断断续续' & @CRLF & _
'[04:44.60][03:19.97][01:51.50]连贝多芬 也都爱上你' & @CRLF & _
'[04:51.56][03:26.31][01:57.91]你说分开最美丽' & @CRLF & _
'[04:57.50][03:32.35][02:03.90]好! 我还想乐章在继续' & @CRLF & _
'[05:04.18][03:38.91][02:10.63]爱来爱去 爱不过是病' & @CRLF & _
'[05:10.57][03:45.15][02:16.77]连贝多芬 都想告诉你' & @CRLF & _
'[05:16.74][03:51.51][02:23.15]耳聋了 更有意义' & @CRLF & _
'[05:22.75][03:57.64][02:29.29]也许你只是下雨下在我的青草地' & @CRLF & _
'[05:29.36][04:04.23][02:35.72]等放晴了 就自然蒸发' & @CRLF
Opt("GUIOnEventMode", 1)
MsgBox (0,"原始Lrc文件",$str)
$Form = GUICreate("Test", 413, 566, @DesktopWidth / 2 - 150, @DesktopHeight / 2 - 320)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
$Edit = GUICtrlCreateEdit("", 1, 8, 408, 550)
GUICtrlSetData(-1, "")
GUISetState()
$aStr = StringRegExp($str, "(\[.*\])([^\]]+)\r", 3)
$maxtime = $aStr[UBound($aStr) - 2]
$out = ""
$t = TimerInit()
While 1
For $i = 0 To UBound($aStr) - 1
$time = StringRegExp($aStr[$i], "\[(.*?)\.", 3)
If IsArray($time) Then
For $j = 0 To UBound($time) - 1
$tmptime = StringSplit($time[$j], ":")
$tagtime = $tmptime[1] * 60 + $tmptime[2]
If Round(TimerDiff($t) / 1000, 2) == Round($tagtime / 5, 2) Then
$out &= $tmptime[1] & ":" & $tmptime[2] & @TAB & $aStr[$i + 1] & @CRLF
GUICtrlSetData($Edit, $out)
Sleep(200)
If $tagtime == "329" Then
Sleep (3000)
GUICtrlSetData($Edit, $out & @CRLF & @TAB & "**********end**********")
ExitLoop
EndIf
EndIf
Next
EndIf
Next
WEnd
Func _exit()
Exit
EndFunc ;==>_exit
|