Hi EdwardATeller
i tried to enhance your script (it will create a playlist for every sub-dir below the chosen one), maybe is useful for you too.
Code:
;
; MPC Playlist Generator Original by EdwardATeller (see http://www.autohotkey.com/forum/topic18393.html)
; enhanced by zx48 5/09
;
; v0.01 Original Version by EdwardATeller
; v0.02 added Sub-dir Routine
; v0.03 added more file extensions
;
prog_name = MPC Playlist Generator v0.03 ; name and version of the program
#NoEnv ; be compatible to new AHK versions in 2007 :)
#SingleInstance, force ; only one program instance allowed
SetBatchLines, -1 ; Make the operation run at maximum speed.
IfExist, Blinky.ico
Menu, Tray, Icon, Blinky.ico ; if exist, show my favorite Simpson icon (try google 4 it :)
Menu, Tray, Tip, %prog_name% (be patient :) ; show program info
ini_name = MPC_Playlist_creator.ini ; settings file name
iniread, SourcePath, %ini_name%, settings, SourcePath, .\ ; save last dir for next use
LOG_File = %A_ScriptDir%\MPC_Playlist_Creator_log.txt
LogShow = 0 ; if true -> show logfile on exit
LogLevel = 2 ; 0 -> 3 log more information (higher value, more information)
PlayList = playlist.mpcpl ; playlist filename
if LogLevel > 1
{
text = Program Started
Log2File(text) ; log text message 2 file
}
fileselectfolder,SRCRootFolder,*%SourcePath%,1, ; choose main directory
if ErrorLevel ; exit on empty source
{
if LogLevel > 0
{
text = ERROR: program closed "source dir selection aborted"
Log2File(text) ; log text message 2 file
}
goto end
}
iniwrite, %SRCRootFolder%, %ini_name%, settings, SourcePath ; save path selection 4 next use
Loop, %SRCRootFolder%\*.*, 2, 1 ; only Folders but recursive
DirList = %DirList%%A_LoopFileFullPath%`n
Sort, DirList, C ; sort Case sensitive
Loop, Parse, DirList,`n
{
if A_Loopfield = ; exit if empty dir :)
break
FileList = ; reset var for next iteration
SetWorkingDir, %A_Loopfield% ; set actual dir for playlist generation
ifNotExist, %PlayList% ; create playlist only if doesn't exist
{
Loop, %A_Loopfield%\*.avi, 0, 0 ; retrieve all AVI Files in current dir
FileList = %FileList%%A_LoopFileName%`n
Loop, %A_Loopfield%\*.wmv, 0, 0 ; retrieve all WMV Files in current dir
FileList = %FileList%%A_LoopFileName%`n
Loop, %A_Loopfield%\*.mpg, 0, 0 ; retrieve all Mpeg Files in current dir
FileList = %FileList%%A_LoopFileName%`n
Loop, %A_Loopfield%\*.mpeg, 0, 0 ; retrieve all MPEG Files in current dir
FileList = %FileList%%A_LoopFileName%`n
Loop, %A_Loopfield%\*.mov, 0, 0 ; retrieve all Quicktime Files in current dir
FileList = %FileList%%A_LoopFileName%`n
Sort, FileList, C ; sort Case sensitive
FileAppend, MPCPLAYLIST`n, %PlayList% ; this is the header of the playlist file
FileCounter = 1
LoopCounter = 1
Loop, parse, FileList,`n
{
if A_Loopfield = ; exit if no file found
break
FileAppend,
(
%FileCounter%,type,0
%FileCounter%,filename,%A_LoopField%
), %PlayList%
FileCounter += 1
LoopCounter += 1
}
if LogLevel > 2
{
text = Playlist for directory %A_Loopfield% created
Log2File(text) ; log text message 2 file
}
if LoopCounter <= 2 ; remove single file playlist's
{
if LogLevel > 1
{
text = single File Playlist for directory %A_Loopfield% erased
Log2File(text) ; log text message 2 file
}
FileDelete, %PlayList%
}
}
}
End:
if LogLevel > 1
{
text = Program ended
Log2File(text) ; log text message 2 file
}
if LogShow
run, notepad.exe %Log_File% ; show log
ExitApp,
return
Log2File(TextToLog) ; Function Log Text 2 File
{
global Log_File ; This global variable was previously given a value somewhere outside this function.
FileAppend, %A_DD%.%A_MM%.%A_YYYY% %A_HOUR%:%A_MIN%:%A_SEC% -> %TextToLog% `n, %Log_File%
}
regards zx48