#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
Global $str
$Form1 = GUICreate("Form1", 523, 463)
$Button1 = GUICtrlCreateButton("Button1", 252, 416, 75, 25)
$ListView1 = GUICtrlCreateListView(" 时 间 | 歌 词 ", 8, 8, 400, 300)
GUISetState(@SW_SHOW)
$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
aaaa()
#EndRegion ### END Koda GUI section ###
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
geci()
EndSwitch
WEnd
Func aaaa()
Local $sR = StringRegExp($str, '\[\d\d:\d\d\.\d\d\]', 3)
_ArraySort($sR)
Local $txt, $i, $_time
$begin = TimerInit()
For $i = 0 To UBound($sR) - 1
$_time = StringRegExpReplace($sR[$i], '(\[|\])', '\\$1')
$txt = StringRegExpReplace($str, '(?s).+?' & $_time & '(?:\[[^\]]+\])*([^\r]*).+', '$1')
GUICtrlCreateListViewItem($_time&"|"&$txt, $ListView1)
Next
EndFunc
Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
If @error Then Return $GUI_RUNDEFMSG
$IDFrom = DllStructGetData($tagNMHDR, 2)
$Event = DllStructGetData($tagNMHDR, 3)
$tagNMHDR = 0
Switch $IDFrom
Case $ListView1
Switch $Event
Case $NM_DBLCLK ; 双击
$JHLIST1 = GUICtrlRead(GUICtrlRead($ListView1))
If $JHLIST1 = "" Then Return
MsgBox(0,0,"双击事件要执行的代码")
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
;以下是逐行显示的代码。
Func geci()
Local $sR = StringRegExp($str, '\[\d\d:\d\d\.\d\d\]', 3)
_ArraySort($sR)
Local $txt, $i, $_time
$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 _IsPressed('1B') Then ExitLoop 2
If Round(TimerDiff($begin)) >= Execute(StringRegExpReplace($sR[$i], '\[(\d\d):(\d\d)\.(\d\d)\]', '$1*60*1000+$2*1000+$3*10')) Then
ToolTip($txt, 0, 0) ;这里的$txt即需要的文本变量,输出只需改动此行。
ExitLoop
EndIf
WEnd
Next
EndFunc