(quit with escape button)
creates subtitle for music or video
Example=
in MEDIA folder : distantdrums.mp3/wav/mpg
distantdrums.jpg (or default lyricplay.jpg)
in SONGTEXT folder :distantdrums.txt
Create Lyric:
start,select create lyric,doubleclick xy.mp3/mpg, starts music/video, cut text with SPACE-bar
play:
start,doubleclick distantdrums.mp3, see created songtext
soundplay works with mpg and wav
for mp3 a small player ,example 1by1 (50kB) http://www.mpesch3.de/
or small Windows Media Player\mplayer2.exe
songtext example (distantdrums.txt)
DISTANT DRUMS (Jim Reeves) I hear the sound of distant drums Far away, far away And if they call for me to come Then I must go, and you must stay So, Mary, marry me, let's not wait Let's share all the time we can before it's too late Love me now, for now is all the time there may be If you love me, Mary, Mary, marry me I hear the sound of bugles blow' Far away, far away And if they call, then I must go Across the sea, so wild and gray So, Mary, marry me, let's not wait Or the distant drums might change our wedding day And love me now, for now is all the time there may be If you love me, Mary, Mary, marry me
;LyricPlay.ahk XP 2005-07-28 garry ;---------------------------------------------------------------------------- ;MPG: built in OS-player ;WAV: built in OS-player ;MP3: with default player or ; with Windows Media Player\mplayer2.exe or ; with 1by1.exe(50kB) http://www.mpesch3.de/ freeware without installation ; [desactivate in display menu elapsing/remaining time in title bar] ; with any other small player ;needs ;example:distantdrums.mp3 ; distantdrums.txt ; distantdrums.jpg (otherwise a default picture [LyricPlay.jpg]) , for mpg no picture ;select CreateLyric and cut songtext with the SPACE-bar ;---------------------------------------------------------------------------- #NoTrayIcon run,%COMSPEC% /C if not exist \SONGTEXT\NUL MD SONGTEXT,,hide run,%COMSPEC% /C if not exist \MEDIA\NUL MD MEDIA,,hide ;----------------------------------------------------------------------------- soundset,100 soundset,0,master,mute menu,help1,Add,&How to Use,MH1 menu,help1,Add,&About,MH2 menu,myMenuBar,Add,Help,:help1 gui,menu,MyMenuBar Gui, Color, 000000 Gui, Font, S10 CDefault , FixedSys Gui, Show, x300 y0 w720 h400,SUBTITLE or KARAOKE Gui,Add, ListView,grid r20 w700 gMyListView, Name|Size Loop,%A_SCRIPTDIR%\MEDIA\*.mpg gosub A4 Loop,%A_SCRIPTDIR%\MEDIA\*.wav gosub A4 Loop,%A_SCRIPTDIR%\MEDIA\*.MP3 gosub A4 GOTO A5 A4: LV_Add("",A_LoopFileName,A_LoopFileSize) LV_ModifyCol() LV_ModifyCol(2, "Integer") return A5: Gui,add,GroupBox,x10 y355 w200 h30 Gui,Font,S8 cwhite, Verdana Gui, Add, Radio, x30 y367 vD1,PLAY Gui, Add, Radio, x90 y367 ,CREATE LYRIC GuiControl,,D1,1 Gui,Add,Button, x600 y365 w82 h20,MIXER return MH1: msgbox,in MEDIA-folder : mpg/mp3/wav/ example:-distantdrums.MP3 & maybe -distantdrums.jpg (or otherwise a default picture will be displayed [LyricPlay.jpg])`r`nin SONGTEXT-folder: example:-distantdrums.txt (the same name then MEDIA-file)`r`n-CREATE :start,select CreateLyric, doubleclick mpg/mp3/wav, video/music plays and cut text with SPACE-bar`r`n-PLAY :start, doubleclick mpg/mp3/wav, video/music plays and see the created text return MH2: msgbox,LYRICPLAY.AHK 2005-07-21 return ;----------------------------------------------------------------- ButtonMixer: run,sndvol32.exe return MyListView: Gui,submit,nohide if A_GuiEvent = DoubleClick { LV_GetText(C1,A_EventInfo,1) } if C1=NAME return if C1=SIZE return if C1= return stringlen,L1,C1 stringmid,NT,C1,1,L1-4 stringright,R3,C1,3 T1=%NT%.txt P1=%NT%.jpg F2=%NT%.csv ifexist %A_SCRIPTDIR%\MEDIA\%P1% GOTO A6 else P1=LYRICPLAY.JPG ;a default picture A6: if D1=2 { ifexist %A_ScriptDir%\SONGTEXT\%F2% { MsgBox, 4, ,%F2% exist, overwrite it ? IfMsgBox,No ExitApp } FILEDELETE %A_ScriptDir%\SONGTEXT\%F2% } if D1=1 { ;counts milliseconds I=0 loop,100 { I+=1 filereadline,LINE,%A_ScriptDir%\SONGTEXT\%F2%,%I% stringsplit,BX,LINE,`;, if ErrorLevel <> 0 GOTO A10 V+=%BX1% } A10: V1:=(V/1000) M1:=V1/60 transform,M,floor,M1 transform,S1,MOD,V1,60 transform,S,floor,S1 stringlen,L,S if L=1 S=0%S% } ;--------------- VIDEO /MUSIC -------------------------------------- if R3=mpg { GOTO WIN2 } if R3=wav { GOTO WIN2 } if R3=mp3 { GOTO A21 } else { msgbox, Only files *.mpg *.mp3 *.wav exitApp } WIN2: ;---------2nd screen ---------------------------------- Gui,show,hide ;hide first screen WA=%A_screenwidth% HA=%A_screenheight% LB:=(HA*5)/100 ;TEXT X-POSITION HB:=(HA*80)/100 ;TEXT Y-POSITION WB:=(WA*90)/100 ;TEXT WIDTH XM:=(WA*20)/100 ;picture YM:=(HA*10)/100 WM:=(WA*60)/100 HM:=(HA*60)/100 if R3=wav { Gui,2:Add,Picture,x%XM% y%YM% w%WM% h%HM%,%A_SCRIPTDIR%\MEDIA\%P1% } Gui,2:-Border Gui,2:Color,000000 ;BLACK Gui,2:Show,x0 y0 w%A_screenwidth% h%A_screenheight% Gui,2:Font,S1 cwhite, Verdana ;border XM:=(WA*1)/100 YM:=(HA*1)/100 WT:=(WA*98)/100 HM:=(HA*98)/100 Gui,2:add,GroupBox,x%XM% y%YM% w%WT% h%HM% soundplay,%A_SCRIPTDIR%\MEDIA\%C1% goto PR1 ;-------------------------------------------------------------------------------- A21: ;--------------------------------------------------------------------------------- if R3=mp3 { Gui,show,hide ;hide first screen ;------1-internplayer ------------------------------------------------ ;http://www.mpesch3.de/ ;--------------------------------------------------------------------- ifexist %A_ScriptDir%\1by1.exe ;intern player { run,"%A_ScriptDir%\1by1.exe" "%A_SCRIPTDIR%\MEDIA\%C1%",,,NewPid1 loop,300 { wingetactivetitle,TI stringlen,C8,C1 stringmid,U,TI,1,C8 if U=%C1% GOTO U2 else sleep,20 } U2: ;winhide,%TI% goto SCR2 } ifexist %A_ProgramFiles%\Windows Media Player\mplayer2.exe ;small Windows Player { run,"%A_ProgramFiles%\Windows Media Player\mplayer2.exe" "%A_SCRIPTDIR%\MEDIA\%C1%",,hide,NewPid1 WinWaitActive,%C1%,, wingetactivetitle,TI GOTO SCR2 } { run,%COMSPEC% /C "%A_SCRIPTDIR%\MEDIA\%C1%",,hide,NewPid1 ;default player } loop,400 { wingetactivetitle,TI ;winactivate,%TI% stringmid,U,TI,1,4 stringmid,C9,C1,1,4 if U=WIND ;Windows Media Player GOTO U1 if U=REAL ;Realplayer: 1234xx.mp3 GOTO U1 if U=%C9% ;(1234)xx.mp3 (quicktime GOTO U1 if U=PLAY ;WINAMP=Player Window GOTO U1 if U=iTUN ;iTUNES GOTO U1 if U=IRFA ;IRFANVIEW GOTO U1 else sleep,100 } U1: ;winhide,%TI% GOTO SCR2 } ;-------------------------------------------------------- SCR2: { Process, priority, %NewPID1%, High process,exist,newpid1 WA=%A_screenwidth% HA=%A_screenheight% LB:=(HA*5)/100 ;TEXT X-POSITION HB:=(HA*80)/100 ;TEXT Y-POSITION WB:=(WA*90)/100 ;TEXT WIDTH XM:=(WA*20)/100 ;picture YM:=(HA*10)/100 WM:=(WA*60)/100 HM:=(HA*60)/100 Gui,2:-Border Gui,2:Color,000000 ;BLACK Gui,2:Font,S12 cwhite, Verdana Gui,2:Show,x0 y0 w%A_screenwidth% h%A_screenheight% Gui,2:Add,Picture,x%XM% y%YM% w%WM% h%HM%,%A_SCRIPTDIR%\MEDIA\%P1% Gui,2:Font,S1 cwhite, Verdana ;border XM:=(WA*1)/100 YM:=(HA*1)/100 WT:=(WA*98)/100 HM:=(HA*98)/100 Gui,2:add,GroupBox,x%XM% y%YM% w%WT% h%HM% GOTO PR1 } ;---------------------------------------------- ;------------------------------------------------ PR1: if D1=1 { GOTO PLAYBACK } if D1=2 { GOTO LYRIC } ;---------------- 1_LYRIC --------------------------------------- LYRIC: Gui,2:Font,S12 cwhite, Verdana LM:=(WA*5)/100 WT:=(WA*95)/100 YM:=(HA*92)/100 Gui,2:Add,TEXT, x%LM% y%YM% w%WT% h20,Modus-Lyric , use the SPACE-BAR to cut the songtext- %TI% Gui,2:Font,S30 cwhite, Verdana { I=0 A1: I+=1 filereadline,A,%A_SCRIPTDIR%\SONGTEXT\%T1%,%I% if A= GOTO A1 if ErrorLevel <> 0 GOTO A2 Gui,2:Add,Edit,x%LB% y%HB% w%WB% h120 ReadOnly,%A% start_time := A_TickCount keywait,space,D ;keywait,control,D TD := A_TickCount - start_time sleep,250 TD:=TD+250 fileappend,%TD%;%A%`r`n,%A_SCRIPTDIR%\SONGTEXT\%F2% goto A1 } A2: Gui,2:Add,Edit,x%LB% y%HB% w%WB% h120 ReadOnly,%X% Gui,2:Font,S12 cwhite, Verdana ES=No more lines.Push space button when the movie or song is finished Gui,2:Add,Edit,x%LB% y%HB% w%WB% h120 ReadOnly,%ES% start_time2:=A_TickCount keywait,space,D ;keywait,control,D TD2:=A_TickCount-start_time2 sleep,250 TD2:=TD2+250 fileappend,%TD2%;`r`n,%A_SCRIPTDIR%\SONGTEXT\%F2% Gui,2:Add,Edit,x%LB% y%HB% w%WB% h60 ReadOnly,%X% Process,close,%NewPid1% send, !{F4} ExitApp ;---------------------------------------------------------------------- ;------------------------- PLAYBACK ----------------------------------- PLAYBACK: ;----------------------------------------------------------- Gui,2:Font,S12 cwhite, Verdana LM:=(WA*5)/100 WT:=(WA*92)/100 YM:=(HA*94)/100 Gui,2:Add,TEXT, x%LM% y%YM% w%WT% h20,Modus-Play Time= %M%:%S% -%TI% Gui,2:Font,S30 cwhite, Verdana { I=0 A11: I+=1 filereadline,LINE,%A_SCRIPTDIR%\SONGTEXT\%F2%,%I% if ErrorLevel <> 0 GOTO ENDP stringsplit,BX,LINE,`;, if BX2= { Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%X% Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%X% GOTO A12 } else { Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%BX2% Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%BX2% } A12: sleep %BX1% goto A11 } ENDP: IF I=1 ;when no lyrics { Gui,2:Font,S12 cwhite, Verdana Gui,2:Add,TEXT, x%LM% y%YM% w%WT% h20,Modus-Play Gui,2:Add,TEXT, x%LM% y%YM% w%WT% h20,Modus-Play Gui,2:Font,S30 cwhite, Verdana Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%C1% Gui,2:Add,TEXT, x%LB% y%HB% w%WB% h120,%C1% keywait,Escape,D } Process,close,%NewPid1% send, !{F4} ExitApp ;------------------------------------------------------------- ;------------------ END ------------------------------- GuiClose: ESC:: Process,close,%NewPid1% send, !{F4} ExitApp