I've been taking a lot from this site and it's users. Now it's time for me to give whatever I can to the community. First some info about this. I use Billy to play my music, and the playlist that it creates is very simple, it's just the path to my files. But since the drive letter changes from computer to computer, I created this vbs script. Here's what it does:
checks the first line of my playlist, splits the line, and reads the drive letter from it. Then checks the drive letter of the usb, if they don't match then it will replace the old drive letter with the new one. So here it is:
arrPath = Split(Wscript.ScriptFullName, "\") drive = arrPath(0) Const ForReading1 = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile(drive & "\Documents\Billy\Playlist.txt", ForReading1) For i = 1 to 1 objTextFile.ReadLine Next strLine = objTextFile.ReadLine arrLine = Split(strLine, "\") objTextFile.Close if arrLine(0) = arrPath(0) Then Wscript.Quit else Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(drive & "\Documents\Billy\Playlist.txt", ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, arrLine(0), arrPath(0)) Set objFile = objFSO.OpenTextFile(drive & "\Documents\Billy\Playlist.txt", ForWriting) objFile.WriteLine strNewText objFile.Close End if
If you want the script to read, lets say, the fourth line, change "For i = 1 to 1" to read "For i = 1 to 3". In other words, one line before the line you want to read. Or if you want to read the first line, delete "For i = 1 to 1" and "Next". Then create an exe using AutoIt or a bat file to run the script then start your music player.
Thanks, I'll add it to my drive
Also, since you have reminded me, I'd like to say thanks for recommending Billy in the first place, it's a great player.
----
Ryan McCue
Current Fav. Songs:
"If you're not part of the solution, you're part of the precipitate."
m3u and pls both support relative paths...
Vintage!
to go through all of the lines in the playlist (note I am assuming that Billy puts one file per line here, I've never used it)
Yours
Steve Lamerton
My Blog
You have to excuse my ignorance. I really don't know much about scripts or codes (or anything related to the inner works of a program). I'm not sure how to implement what you are saying. Please explain. But, yes, Billy does put one file per line.
---------------
Marge: Homer, the plant called. They said if you don't show up tomorrow don't bother showing up on Monday.
Homer: Woo-hoo. Four-day weekend.
"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin
basically the Do While loop goes through each line in the text file, so you could then process each line in the loop, I'll upload what I mean tomorrow.
Yours
Steve Lamerton
My Blog