 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Natascha Bakker Guest
|
Posted: Sun May 17, 2009 12:13 am Post subject: select song for a button and save it! |
|
|
I think i must use a .txt or .ini to make a open file and play button for the next problem. After many days i give i up, maybe some can help me. I have on button A the sound.map, but i want to select a other mp3 song and so that i close the program, hw wil start with the song i last have select it.
Can somebody help me with this problem? Thanks.
| Code: | Gui, Show, x300 y3 h125 w117, test
Gui, Add, Button, x6 y48 w100 h30 ga, &Sound a
Gui, Add, Button, x10 y0 w80 h30 gOpenFile, Open File
a::
SoundPlay, %A_ScriptDir%\a.mp3
return
OpenFile:
TransFile =
FixedFile =
fileselectfile,TransFile,,,Please Select A Transcription File To Fix.
Exit
GuiClose:
GuiEscape:
ExitApp |
|
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Sun May 17, 2009 6:56 am Post subject: |
|
|
example with text file ( or ini) to keep last selected song
see also Fileselectfile options , here preselected c:\music to search from , search only mp3 or wav
| Code: | MP3INI=%A_scriptdir%\MP3INI.txt
ifnotexist,%MP3INI%
IniWrite,nothing , %MP3INI% ,MP3path , KEY1
Gui, Show, x300 y3 h125 w117, test
Gui, Add, Button, x10 y10 w80 h25 gOpenFile, SelectMP3
Gui, Add, Button, x10 y40 w80 h25 ga, Play
Gui, Add, Button, x10 y70 w80 h25 gS, Stop
return
s:
soundplay,notexisted.mp3
return
a:
IniRead,MP3VAR1, %MP3INI% ,MP3path , KEY1
if mp3var1=nothing
{
msgbox,%mp3var1%`nNothing selected
return
}
SoundPlay,%MP3VAR1%
return
OpenFile:
FileSelectFile, selectedmp3 ,1, C:\music\, Select your file,*.mp3;*.wav
IniWrite,%selectedmp3% , %MP3INI% ,MP3path , KEY1
return
GuiClose:
ExitApp
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Mon May 18, 2009 7:03 am Post subject: Another question if is possible and how |
|
|
Hey!!!
Thanks for support, this works great!!!
I don’t know if this is possible but, I try to mute, or min the volume of media player and/or itunes when a song/jingle is playing. In a old version I had a jingle (3 sec), when I push on button A, the jingle was playing and he mute the mediaplayer for 3 sec, so when the jingle was stop after 3 sec the music from mediaplayer was back, very simple and works perfect. But now I can select/open a new jingle but maybe this jingle is longer than 3 sec, can it be so that ahk read the how long this jingle is and mute the x seconds mediaplayer?
I have here a example from my old situation.
| Code: |
a::
SoundPlay, %A_ScriptDir% \a.mp3
PostMessage, 0x111, 18816, 50, , Windows Media Player
SoundSet, 1, Microphone, mute
soundset, 1, Line, mute
soundset, 1, Cd, mute
soundset, 1, Aux, mute
SetTimer, a_continue, -3100 ; run a_continue once, in 4 seconds.
return
a_continue:
SoundSet, 0, Microphone, mute
soundset, 0, Line, mute
soundset, 0, Cd, mute
soundset, 0, Aux, mute
PostMessage, 0x111, 18815, 50, , Windows Media Player
return
|
X Natascha |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Mon May 18, 2009 10:14 pm Post subject: |
|
|
goeden avond natasha
commandline tag.exe reads MP3-tag
example below shows length from MP3 file
| Code: |
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
;----------------------------------------------------------------------------
Musicfile="A rua dos meus ciumes.mp3"
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%
;Details: 44100 Hz Stereo, 140 kbps, playtime 02:10
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%
exitapp
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Mon May 18, 2009 11:18 pm Post subject: THANKS!!!! |
|
|
Hey Gary, Nederlands? Leuk zeg
Mmm thats very nice, i hope i can find out how i can put that into the example before u give me. Intregrate it with the mp3ini.txt example right? Hints and sugestions are always welcome.
Its realy nice programming with AHK, you can do so much with this.
X Natas  |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Wed May 20, 2009 7:54 am Post subject: |
|
|
hello Natasha,
sorry for late answer, ik ben terug, was not "available"
( not sure what you want )
example below
- songs are in c:\music
- select a song and a short song (jingle, example 5 seconds)
- PLAY music and when press key (a) breaks music (MUTE) for 5 seconds
needs commandfile tool tag.exe to get MP3 file duration in milliseconds
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
| Code: | SetFormat,float,0.0
AA=c:\music\ ;MP3 file search begin from here
SoundSet,90,master ;SPEAKER=MASTER volume procent
MP3INI=%A_scriptdir%\MP3INI.txt
ifnotexist,%MP3INI%
{
IniWrite,nothing1 , %MP3INI% ,MP3path , KEY1
IniWrite,nothing2 , %MP3INI% ,MP3short , KEY2
IniWrite,2000x , %MP3INI% ,MP3shortlenght , KEY3
}
;-------- menu ----------------------------------------------
Menu,S2,add,Select MP3 ,MH11
Menu,S2,add,Select MP3 short jingle ,MH12
menu, myMenuBar, Add, Select MP3 ,:S2
gui,2:menu,MyMenuBar
;----------------------------------------------------
Gui,2:Add, Button, x10 y10 w110 h25 gPlay1, Play
Gui,2:Add, Button, x10 y40 w110 h25 gStop1, Stop
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
Gui,2:Add, Text , x10 y80 ,Push (a) to break for
Gui,2:Add, Text , x180 y80 ,sec
Gui,2:Add, Text , x10 y110 ,Master Volume
Gui,2:Add, Edit , x120 y80 w50 h25 vTIME1,
Gui,2:Add, Edit , x120 y110 w50 h25 vMUTE1,
Gui,2:Show, x300 y3 h150 w210, Test
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
SoundGet, master_volume
GuiControl,2:Text,Mute1,%master_volume%`%
return
a::
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
if MP3L1=2000x
{
msgbox,select first a short MP3 file jingle
return
}
;msgbox,%MP3L1%
soundset, 1,master,mute ;SPEAKER=MASTER OFF
GuiControl,2:Text,Mute1,MUTE
sleep,%MP3L1%
soundset, 0,master,mute ;SPEAKER=MASTER ON
SoundGet, master_volume
GuiControl,2:Text,Mute1,%master_volume%`%
return
stop1:
soundplay,notexisted.mp3
return
play1:
IniRead,MP3VAR1, %MP3INI% ,MP3path , KEY1
if mp3var1=nothing1
{
msgbox,%mp3var1%`nNothing selected`nSelect MP3 first
return
}
SoundPlay,%MP3VAR1%
return
MH11:
;--- write MP3 file path serch begin from path
FileSelectFile, selectedmp3 ,1, %AA%, Select your MP3/WAV-file,*.mp3;*.wav
if selectedmp3=
return
IniWrite,%selectedmp3% , %MP3INI% ,MP3path , KEY1
return
MH12:
; --- 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,A2
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
return
2GuiClose:
ExitApp
;---------------------------------------------------------------------------
A2:
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
;----------------------------------------------------------------------------
IniRead,MP3VAR2, %MP3INI% ,MP3short , KEY2
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%
;Details: 44100 Hz Stereo, 128 kbps, playtime 01:09
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 , KEY3
;exitapp
return
;------------------------------------------------------------------------------
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Wed May 20, 2009 5:12 pm Post subject: Gonna be great |
|
|
Bedankt he, begin zo veel te snappen ahah,
Hey Thanks, i try to find out tonight if i can use this with this configuration.
What i mean is that if i play a song with mediaplayer i start this ahk script, than i load a jingle and ahk know how long this jingle is, so when push the a button, he down the volume of mediaplayer and play the jingle, when the jingle has stops, the volume from mediaplayer comes back and so i hear the song. but with this examples, i think can find out, i am not so good programmer but can try.
Thanks for support, really nice
x Natascha |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Wed May 20, 2009 10:13 pm Post subject: |
|
|
dank U Natasha
maybe can also start another player , example vlc.exe and control volume for vlc and windows media player
run,%A_programfiles%\VideoLAN\VLC\vlc.exe xy.mp3
or
soundplay
an example to watch and record tv stream Hilversum Nederland
( here in switzerland acces denied )
| Code: | MODIFIED = 20090201
;plays and record TV hilversum ( only nederland)
;http://www.videolan.org/vlc/
;C:\Programme\VideoLAN\VLC\vlc.exe
;mms://livemedia.omroep.nl/nos_hilversumbest-bb ;no more works
;http://www.omroep.nl/live/thema/nos_hilversumbest-bb-nl.asx ; not allowed outside nederland
#NoEnv
SetBatchlines -1
SendMode Input
setworkingdir, %a_scriptdir%
REC =c:\_RECORDED1
run,%COMSPEC% /C if not exist \%REC%\NUL MD %REC%,,hide
Gui,2:Color,black
Gui,2:Font, S10 CDefault , Lucida Console
HilversumINI=%A_scriptdir%\HilversumINI.ini
ifnotexist,%HilversumINI%
{
IniWrite,c:\_RECORDED1 , %HilversumINI% ,RecordPath , KEY1
IniWrite,%A_programfiles%\VideoLAN\VLC\vlc.exe , %HilversumINI% ,VLCPath , KEY1
}
;-------------- TOOLS ---------------------------
Menu,S2,add,Select once path where Record Video ,MH11
Menu,S2,add,Select once path vlc.exe ,MH12
Menu,S2,add,Download vlc.exe if not exist ,MH13
;menu, myMenuBar, Add, Settings ,:S1
menu, myMenuBar, Add, Tools ,:S2
gui,2:menu,MyMenuBar
;----------------------------------------------------
Gui,2:Add,Button, x10 y10 h25 w100 gPLAY1 ,Watch
Gui,2:Add,Button, x130 y10 h25 w100 gRecord1 ,Record
Gui,2:Add,Button, x10 y50 h25 w220 gRecord2 ,Record and Watch
Gui,2:Add,Button, x250 y10 h25 w150 gFolder1 ,FOLDER-RECORDED
Gui,2:Add,Button, x250 y50 h25 w150 gProgram1 ,Program
IniRead, Rec , %HilversumINI% ,RecordPath , KEY1
IniRead, VLCPath1 , %HilversumINI% ,VLCPath , KEY1
Gui,2:Show, x0 y0 h100 w410 ,Hilversum TV
ifexist,%VLCPath1%
return
else
msgbox, 262208,Check if vlc.exe exist,Vlc.exe didn't found`nClick on Tools to download vlc.exe or`nClick on Tools to select the correct path from vlc.exe
return
;-------------------------------------------------------------------
2Guiclose:
exitapp
MH11:
IniRead, Rec , %HilversumINI% ,RecordPath , KEY1
msgbox, 262468, Where to record Video,The folder`n%REC%`nis selected to record TV Hilversum`nWant you select a new Folder ?
ifmsgbox,no
return
FileSelectFolder,MF,
if MF=
return
IniWrite,%MF% , %HilversumINI% ,RecordPath , KEY1
return
MH12:
FileSelectFile, SelectedFile, 3,%A_programfiles% , Open a file, ExeFile (*.exe)
if SelectedFile=
return
IniWrite,%Selectedfile% , %HilversumINI% ,VLCPath , KEY1
return
MH13:
run,http://www.videolan.org/vlc/
return
Folder1:
Gui,2:submit,nohide
IniRead, Rec , %HilversumINI% ,RecordPath , KEY1
run,%rec%
return
Play1:
Gui,2:submit,nohide
IniRead, VLCPath1 , %HilversumINI% ,VLCPath , KEY1
;URL1=mms://livemedia.omroep.nl/nos_hilversumbest-bb ; no more works
URL1=http://www.omroep.nl/live/thema/nos_hilversumbest-bb-nl.asx ; not allowed outside nederland
run,%VLCPath1% %URL1%
return
record1:
Gui,2:submit,nohide
IniRead, Rec , %HilversumINI% ,RecordPath , KEY1
IniRead, VLCPath1 , %HilversumINI% ,VLCPath , KEY1
WHERE=%REC%\%A_now%_HILVERSUM.mpg
;URL1=mms://livemedia.omroep.nl/nos_hilversumbest-bb
URL1=http://www.omroep.nl/live/thema/nos_hilversumbest-bb-nl.asx ; not allowed outside nederland
BBBB= :sout=#transcode{vcodec=mp2v,vb=1024,scale=1,acodec=mp3,ab=192,channels=2}:duplicate{dst=std{access=file,mux=ps,dst="%where%"}}
run,%VLCPath1% %URL1% %BBBB%
return
record2:
Gui,2:submit,nohide
IniRead, Rec , %HilversumINI% ,RecordPath , KEY1
IniRead, VLCPath1 , %HilversumINI% ,VLCPath , KEY1
;VLCpath1=%A_programfiles%\VideoLAN\VLC\vlc.exe
WHERE=%REC%\%A_now%_HILVERSUM.mpg
;URL1=mms://livemedia.omroep.nl/nos_hilversumbest-bb
URL1=http://www.omroep.nl/live/thema/nos_hilversumbest-bb-nl.asx ; not allowed outside nederland
BBBB= :sout=#transcode{vcodec=mp2v,vb=800,scale=1,acodec=mp3,ab=128,channels=2}:duplicate{dst=display,dst=std{access=file,mux=ps,dst="%where%"}}
run,%VLCPath1% %URL1% %BBBB%
return
Program1:
run,http://portal.omroep.nl/hilversumbest?waxtrapp=uvzlyMsHfCpEVAsDnD
return
;http://player.omroep.nl/?zenid=252&skin=hilversumbest ;play
;http://portal.omroep.nl/hilversumbest?waxtrapp=ortvaZsHfCpEVAO ;home
;===================================================================================================
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Wed May 20, 2009 10:53 pm Post subject: |
|
|
Gary
Thanks, but i want to play songs from mediaplayer, with ahk to mute or down the volume automatich when selected jingle is playing
x natas |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Thu May 21, 2009 8:30 am Post subject: |
|
|
understand, have no windows mediaplayer, don´t know how to control the volume from song1 and song2
this command just for speaker on/off and set volume level
| Quote: |
soundset, 0,master,mute ;SPEAKER=MASTER ON
SoundSet,90,master ;SPEAKER=MASTER volume procent
|
maybe like that, but then starts song1 new again at beginning
| Code: |
soundplay,song1.mp3
sleep,4000
soundplay,notexisted.mp3 ;stops song1
soundplay, song2.mp3 ;start song2
sleep,3000
soundplay,notexisted.mp3 ;stops song2
soundplay,song1.mp3 ;start song1 new
|
here another example
| Code: | MODIFIED=20090523
/*
-select a music (long) and a music (short / jingle) for break
-play music (long / vlc.exe)
-when push button-jingle music breaks for x-seconds (calculated with tag.exe)
*/
VLC=%A_programfiles%\VideoLAN\VLC\vlc.exe
SetFormat,float,0.0
AA=c:\music\ ;MP3 file search begin from here
SoundSet,90,master ;SPEAKER=MASTER volume procent
MP3INI=%A_scriptdir%\MP3INI.txt
ifnotexist,%MP3INI%
{
IniWrite,nothing1 , %MP3INI% ,MP3path , KEY1
IniWrite,nothing2 , %MP3INI% ,MP3short , KEY2
IniWrite,2000x , %MP3INI% ,MP3shortlenght , KEY3
}
;-------- menu ----------------------------------------------
Menu,S2,add,Select MP3 ,MH11
Menu,S2,add,Select MP3 short jingle ,MH12
menu, myMenuBar, Add, Select MP3 ,:S2
gui,2:menu,MyMenuBar
;----------------------------------------------------
Gui,2:Add, Button, x10 y10 w110 h25 gPlay1, Play
Gui,2:Add, Button, x10 y40 w110 h25 gStop1, Stop
Gui,2:Add, Button, x140 y10 w90 h25 gJingle1,Jingle1
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
Gui,2:Add, Text , x10 y80 ,Jingle1 break for
Gui,2:Add, Text , x180 y80 ,sec
Gui,2:Add, Text , x10 y110 ,Master Volume
Gui,2:Add, Edit , x120 y80 w50 h25 vTIME1,
Gui,2:Add, Edit , x120 y110 w50 h25 vMUTE1,
Gui,2:Add, Edit , x120 y140 w50 h25 vPLAYX,
Gui,2:Show, x300 y3 h180 w240, Test
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
SoundGet, master_volume
GuiControl,2:Text,Mute1,%master_volume%`%
return
stop1:
soundplay,notexisted.mp3
moz=ahk_class QWidget
IfWinExist, %moz%
{
WinActivate, %moz%
WinWaitActive, %moz%,,5
ControlSend,,S, %moz%
}
return
;-------------- plays jingle for x seconds , pause music vlc.exe ----------
Jingle1:
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
if MP3L1=2000x
{
msgbox,select first a short MP3 file jingle
return
}
GuiControl,2:Text,playx,Jingle1
IniRead,MP3jingle1 , %MP3INI% ,MP3short , KEY2
;---- see window spy --------------------
moz=ahk_class QWidget
IfWinExist, %moz%
{
;WinActivate, %moz%
;WinWaitActive, %moz%,,5
ControlSend,,{space}, %moz%
}
soundplay,%MP3jingle1%
sleep,%MP3L1%
soundplay,notexisted.mp3
IfWinExist, %moz%
{
;WinActivate, %moz%
;WinWaitActive, %moz%,,5
ControlSend,,{space}, %moz%
}
GuiControl,2:Text,playx,MUSIC
return
;------- play MUSIC which will paused by jingle ---------
play1:
IniRead,MP3VAR1, %MP3INI% ,MP3path , KEY1
if mp3var1=nothing1
{
msgbox,%mp3var1%`nNothing selected`nSelect MP3 first
return
}
;SoundPlay,%MP3VAR1%
run,%vlc% %MP3VAR1%
GuiControl,2:Text,playx,MUSIC
return
MH11:
;--- write MP3 file path serch begin from path
FileSelectFile, selectedmp3 ,1, %AA%, Select your MP3/WAV-file,*.mp3;*.wav
if selectedmp3=
return
IniWrite,%selectedmp3% , %MP3INI% ,MP3path , KEY1
return
MH12:
; --- 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,A2
IniRead,MP3L1, %MP3INI% ,MP3shortlenght , KEY3
MP3L2:=(MP3L1/1000)
GuiControl,2:Text,Time1,%MP3L2%
return
2GuiClose:
ExitApp
;---------------------------------------------------------------------------
A2:
;---------------------- TIME LENGHT DURATION MP3----------------------------
;TAG........... http://www.softpedia.com/progDownload/Tag-Download-21935.html
;----------------------------------------------------------------------------
IniRead,MP3VAR2, %MP3INI% ,MP3short , KEY2
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%
;Details: 44100 Hz Stereo, 128 kbps, playtime 01:09
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 , KEY3
;exitapp
return
;------------------------------------------------------------------------------
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Sun Jun 21, 2009 12:56 pm Post subject: beter idea? |
|
|
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
;------------------------------------------------------------------------------
|
|
|
| Back to top |
|
 |
nataschabakker
Joined: 18 May 2009 Posts: 11 Location: Amsterdam Holand
|
Posted: Wed Jun 24, 2009 10:50 am Post subject: play full jingle |
|
|
Hi Gary, or other supporters.
What I see is that some jingles be exact 2 sec, and the mute is also 2 sec, but sometimes a jingle is 2.5 sec , he see and make it 2 sec, not 2.5. So what you hear is a jingle breakup and music is back. Is it possible to play the jingle full (example 2.5 sec) and music back with 2.0, so again, music back after the sec he think it is and jingle always play full lengte.
2.5 is a example he
Xxx bye Natascha |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|