1:: play contents of folder 1
2:: play contents of folder 2
3:: play contents of folder 3
and they work great, until I try to press 1, 2 or 3 for a second time ... which does not work. Is it because of the SoundPlay loop? How do I correct this?
I can press "1" and folder 1 starts playing, can be interrupted by pressing "2" then "3" but then none of the keys work again.
Code: Select all
#SingleInstance, Force
1::
FileList := "" ; clears file list
Loop, %A_ScriptDir%\playlist01\*.*, 1 ; loops through "playlist01" folder for (presumably) audio files
FileList .= A_LoopFileName "`n" ; puts audio files on a list
Sort, FileList, Random U ; randomizes list and removes duplicates
MsgBox, %FileList% ; (temp) shows the randomized list of files
Loop, parse, FileList, `n ; reads file list
Soundplay, %A_ScriptDir%\playlist01\%A_LoopField%, wait ; plays each entry on list
return
2::
FileList := ""
Loop, %A_ScriptDir%\playlist02\*.*, 1
FileList .= A_LoopFileName "`n"
Sort, FileList, Random U
MsgBox, %FileList%
Loop, parse, FileList, `n
Soundplay, %A_ScriptDir%\playlist02\%A_LoopField%, wait
return
3::
FileList := ""
Loop, %A_ScriptDir%\playlist03\*.*, 1
FileList .= A_LoopFileName "`n"
Sort, FileList, Random U
MsgBox, %FileList%
Loop, parse, FileList, `n
Soundplay, %A_ScriptDir%\playlist03\%A_LoopField%, wait
return
ESC::
ExitApp