loop, %A_AppData%\.purple\logs\aim\*\randomsn\*.html { Filelist := FileList "," A_loopFileName }
The function would be to allow one folder (or multiple folders, but only if seperated by a \) to be variable and still be able to build a file list.
If you want a can build a "proof of concept" function, but I really would like to see it added to ahk itself.
Edit: Built the "proof of concept" function. I will keep this post up to date with the newest version, just in case it breaks or I add new features.
Version 1.1
; ; AutoHotkey Version: 1.0.47.5 ; Language: English ; Platform: WinXP Pro ; Author: William Washco <[email protected]> ; ; Script Function: ; Convert paths with wildcards to a file list. ; /* #singleinstance, force WildcardFolder = C:\Program Files\*\*\ File = *.exe List := WildcardFolderList(WildcardFolder,File) msgbox, %List% Return */ WildcardFolderList(Path,FilePattern) { StringReplace, Newpath, Path, *\, ¤,A StringSplit, Folders, Newpath, ¤ Loops := Folders0 - 1 Folders1 := Folders1 . "*" Loop, %Loops% { Nextlevel := "" TempList := "" Wildcard := "" loop, parse, Folders%A_Index%, `, { loop, %A_LoopField%, 2 { If (NextLevel != "") NextLevel := NextLevel . "," . A_LoopFileLongPath Else NextLevel := A_LoopFileLongPath } } Next := A_Index + 1 If (A_Index != Loops) Wildcard := "*" Loop, parse, NextLevel, `, { If (A_Index != 1) TempList := TempList . "," A_LoopField . "\" . Folders%Next% . Wildcard Else TempList := A_LoopField . "\" . Folders%Next% . Wildcard } Folders%Next% := TempList } FoundFolders := 0 loop, parse, TempList, `, { Ifexist, %A_LoopField% { If (FolderListing != "") FolderListing := FolderListing . "," . A_LoopField Else FolderListing := A_LoopField } } Loop, parse, FolderListing, `, { WildFile := A_LoopField . "\" . FilePattern TempFileList := "" Loop, %WildFile% { If (TempFileList != "") TempFileList := TempFileList . "," . A_LoopFileLongPath Else TempFileList := A_LoopFileLongPath } If (TempFileList = "") continue If (A_Index != 1) FileList := FileList . "," . TempFileList Else FileList := TempFileList } Return, FileList }
*NOTE* My code posted here has been pointed out to NOT be the best solution. Please read further for code as short as 9 lines long. Including the function header and curly braces.