搞定#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 502, 81, 262, 265)
$Label1 = GUICtrlCreateLabel("作者:35888894", 8, 16, 484, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Label2 = GUICtrlCreateLabel("作者:35", 8, 16, 484, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0080)
$Button1 = GUICtrlCreateButton("PLAY", 8, 48, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$work=0
Dim $neirong[9999]
idopen()
$line_1=0
Dim $shijian
Dim $sjpd
Dim $geshu
$tm=0
$numold=0
$num=0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$sound = _SoundOpen("zhoujielun-daoxiang.mp3")
_SoundPlay($sound)
$work=1
$line_1=0
EndSwitch
If $work=1 Then
$tm=_SoundPos ( $sound,2)
; ToolTip($tm&" "&Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))&" num="&$num&" shijian="&$shijian&" geshu="&$geshu )
If $tm>=Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2))) Then
$shijian=Int((StringMid($neirong[$line_1+1],2,2))*60*1000+Int(StringMid($neirong[$line_1+1],5,2))*1000+Int(StringMid($neirong[$line_1+1],8,2)))-Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))
GUICtrlSetData($Label1,StringMid($neirong[$line_1],11))
GUICtrlSetFont($Label1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor($Label1, 0xC0C0C0)
GUICtrlSetBkColor($Label1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetData($Label2,"")
GUICtrlSetFont($Label2, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor($Label2, 0xFF0080)
GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT)
$geshu=StringLen(StringMid($neirong[$line_1],11))
If $geshu>0 Then
$sjpd=$shijian/($geshu)
EndIf
$line_1+=1
EndIf
;------------------------------------------------------------------红字歌词循环
$num=Ceiling($geshu-(Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))-$tm)/$sjpd)
; ToolTip($tm&" "&Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))&" num="&$num&" shijian="&$shijian&" geshu="&$geshu )
If $num>=0 And $num <> $numold And $line_1>0 Then
; Beep(1000,10)
rgc($num)
$numold =$num
EndIf
;------------------------------------------------------------------
If $tm=_SoundLength ( $sound,2) Then _SoundClose ( $sound )
EndIf
WEnd
Func idopen()
$var="F:\AU3学习\音乐播放\zhoujielun-daoxiang.txt"
If $var<>"" Then
Local $aArray
_FileReadToArray ( $var, $aArray)
For $i=0 To $aArray[0]-1
If $aArray[$i+1]="" Then ExitLoop
;_GUICtrlListBox_AddString($List1,$aArray[$i+1])
$neirong[$i]=$aArray[$i+1]
Next
EndIf
EndFunc
Func rgc($co)
GUICtrlSetData($Label2,StringMid(StringMid($neirong[$line_1-1],11),1,$co))
GUICtrlSetFont($Label2, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor($Label2, 0xFF0080)
GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT)
EndFunc
注意歌词必须是[00:02.00]周杰伦 - 稻香,这样的格式,否则会出错,前面必须是“[00:02.00]"这样的格式 |