Hi after a nights sleep ive got it working thanks to you. I am now a big step closer to making my playlist for my player here is what ive done, or rather what you did most of for me.
Dim fileName1 As String = "C:\filedemo_streamwriter.vbs"
Using writer As New IO.StreamWriter(fileName1)
'writer.Write("This is a demo using a StreamWriter object.")
writer.Write(TextBox1a.Text)
writer.Close()
End Using
Dim fileName2 As String = "C:\filedemo_file.vbs"
IO.File.WriteAllText(fileName2, "This is a demo using the File class")
End Sub
This is the vbs file that your code now writes into a directory which makes the playlist.
m3uName = fdr.ParentFolder.Name & " (" & fdr.Name & ").m3u"
else
m3uName = fdr.Name & ".m3u"
end if
' Existing m3u file handling
m3u = path & "\" & m3uName
if fso.FileExists(m3u) then
if delete then
wscript.echo "... deleting existing file"
fso.DeleteFile m3u
else
wscript.echo "... renaming existing file"
fso.MoveFile m3u, m3u & ".old"
end if
end if
' Write new m3u file
wscript.echo "... writing """ & m3uName & """"
set m3uFile = fso.OpenTextFile(m3u, ForWriting, True)
m3uFile.Write(mp3List)
m3uFile.Close
count = 1
else
wscript.echo "... no mp3/wma files found"
end if
end if
' Return m3u file count
WriteM3u = count
end function
I am gradualy adding more file extensions to it. This may seem a long way round about making a playlist but as you have gathered I am not that brilliant with code and this stuff realy does help me to learn. Besides I love trying stuff. Regards Bill