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.