Hi, sorry i am so late with reaction (to bussy with fam (die someone)).
But oke, i trying somehtings out ands works perfect, now a trying to add a second tune button with open/select button but now he give troubles.
Somtimes the music is back and stop the jingle before the jingle has finisch the end. Can some one help me? Or maybe can some one see things better in this script.
Thanks again
xxx Natascha
Code:
SetFormat,float,0.0
MP3INI=%A_scriptdir%\MP3INI.txt
ifnotexist,%MP3INI%
{
IniWrite,nothing2 , %MP3INI% ,MP3short , KEY1
IniWrite,2000x , %MP3INI% ,MP3shortlenght , KEY_1
IniWrite,nothing2 , %MP3INI% ,MP3short , KEY2
IniWrite,2000x , %MP3INI% ,MP3shortlenght , KEY_2
}
Gui,2:Add, Button, x10 y10 w90 h90 gJingle1,Tune 1
Gui,2:Add, Picture, x10 y110 w18 h18 gMH1,%A_ScriptDir%\inc\open.ico
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY_1
Gui,2:Add, Text , x30 y110 ,Select
Gui,2:Add, Button, x10 y130 w90 h90 gJingle2,Tune 2
Gui,2:Add, Picture, x10 y230 w18 h18 gMH2,%A_ScriptDir%\inc\open.ico
IniRead,MP3L2, %MP3INI% ,MP3shortlenght , KEY_2
Gui,2:Add, Text , x30 y230 ,Select
Gui,2:Show, x300 y3 h260 w130, Test
MP3L2:=(MP3L1/1000)
MP3L2:=(MP3L2/1000)
return
;-------------- plays jingle1 for x seconds ----------
Jingle1:
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
GuiControl,2:Text,playx,Jingle1
IniRead,MP3jingle1 , %MP3INI% ,MP3short , KEY1
soundplay,%MP3jingle1%
SetTimer, a_continue, %MP3L1% ; run a_continue once, in 4 seconds.
return
a_continue:
soundplay,notexisted.mp3
IfWinExist, %moz%
{
;WinActivate, %moz%
;WinWaitActive, %moz%,,5
ControlSend,,{space}, %moz%
}
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
return
MH1:
; --- write MP3 file path short jingle ------------
FileSelectFile, selectedmp3short ,1, %AA%, Select your MP3/WAV file short jingle,*.mp3;*.wav
if selectedmp3short=
return
IniWrite,%selectedmp3short% , %MP3INI% ,MP3short , KEY1
gosub,A2
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY_1
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
return
;---------------------------------------------------------------------------
A2:
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
;----------------------------------------------------------------------------
IniRead,MP3VAR2, %MP3INI% ,MP3short , KEY1
Musicfile="%MP3VAR2%"
F1=test55.txt
ifexist,%F1%
Filedelete,%F1%
DetectHiddenWindows On
mycmd=tag.exe --test --tofilen %F1% %Musicfile%
run,%comspec% /K %myCmd%,,hide,PID1
WinWait %ComSpec% ahk_pid %PID1%
WinActivate ahk_pid %PID1%
process,close,%PID1%
loop,read,%F1%
{
LR=%A_loopreadline%
ifinstring,LR,Details:
stringsplit,C,LR,`,
stringsplit,D,C3,`:
stringmid,d1a,d1,11,2
}
D1b:=ABS(D1a)
D2b:=ABS(D2)
MINMilliSEC:=((D1b*60)*1000)
SECMilliSEC:=(D2b*1000)
Total:=(MINMilliSEC+SECMilliSEC)
;msgbox,Minutes-ms=%MINmilliSEC%`nSeconds-ms=%SECMilliSEC%`nTotal=%total%
;run,%F1%
IniWrite,%Total% , %MP3INI% ,MP3shortlenght , KEY_1
;exitapp
return
;------------------------------------------------------------------------------
-------------- plays jingle2 for x seconds ----------
Jingle2:
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
PostMessage, 0x111, 18816, 150, , Windows Media Player
GuiControl,2:Text,playx,Jingle2
IniRead,MP3jingle2 , %MP3INI% ,MP3short , KEY2
soundplay,%MP3jingle2%
SetTimer, a_continue2, %MP3L1% ; run a_continue2 once, in 4 seconds.
return
a_continue2:
soundplay,notexisted.mp3
IfWinExist, %moz%
{
;WinActivate, %moz%
;WinWaitActive, %moz%,,5
ControlSend,,{space}, %moz%
}
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
PostMessage, 0x111, 18815, 50, , Windows Media Player
return
MH2:
; --- write MP3 file path short jingle ------------
FileSelectFile, selectedmp3short ,1, %AA%, Select your MP3/WAV file short jingle,*.mp3;*.wav
if selectedmp3short=
return
IniWrite,%selectedmp3short% , %MP3INI% ,MP3short , KEY2
gosub,A22
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY_2
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
return
2GuiClose:
ExitApp
;---------------------------------------------------------------------------
A22:
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
;----------------------------------------------------------------------------
IniRead,MP3VAR2, %MP3INI% ,MP3short , KEY2
Musicfile="%MP3VAR2%"
F1=test2.txt
ifexist,%F1%
Filedelete,%F1%
DetectHiddenWindows On
mycmd=tag.exe --test --tofilen %F1% %Musicfile%
run,%comspec% /K %myCmd%,,hide,PID1
WinWait %ComSpec% ahk_pid %PID1%
WinActivate ahk_pid %PID1%
process,close,%PID1%
loop,read,%F1%
{
LR=%A_loopreadline%
ifinstring,LR,Details:
stringsplit,C,LR,`,
stringsplit,D,C3,`:
stringmid,d1a,d1,11,2
}
D1b:=ABS(D1a)
D2b:=ABS(D2)
MINMilliSEC:=((D1b*60)*1000)
SECMilliSEC:=(D2b*1000)
Total:=(MINMilliSEC+SECMilliSEC)
;msgbox,Minutes-ms=%MINmilliSEC%`nSeconds-ms=%SECMilliSEC%`nTotal=%total%
;run,%F1%
IniWrite,%Total% , %MP3INI% ,MP3shortlenght , KEY_2
;exitapp
return
;------------------------------------------------------------------------------