I play Grand Theft Auto: Vice City for Windows often, and I realized that if one puts mp3s in the ‘mp3’ subdir of the game directory, one can play such mp3s in-game on car radios. Awesome. However, the playlist seems to reset each time I die, or maybe each time I load the game, meaning I hear the first few songs over and over and over and over and over and over and over, etc. This is particularly a problem when playing Multi Theft Auto as, it being a multiplayer everyone-kill-everyone-else type deal one is more likely to die, and it also makes GTA:VC itself crash a fair bit.
So I want to solve this problem, perhaps by adding a random letter or letter sequence or somesuch to the beginning of each mp3 file, and then randomly changing those letters each time I run GTA/MTA. I could dust off my old Python tricks, but it’s been a long, long time since I coded anything.
Well, I’d personally use a .vbs vbscript file for that, especially if I was on a computer where the antivirus didn’t immediate jump on vbs files.
Going through the whole process is more than I’m up for at the moment… you can grab a Scripting.Filesystem COM instance, use a folder object and its files collection to scan the proper directory, use randomize and rnd (and probably chr and asc) to generate your random letter prefixes, and then call the .rename method of a file over and over.
In the spirit of a code example being worth a thousand babbling words, I thought I’d throw this in. It’s the text of a VBS file to work with filenames in a directory - it’s not randomized but shrug.
Purpose: to take screencap files generated by powerDVD and standardize the numeric portion to four digits, so that 50 is sorted before 149 (by making them 0050 and 0149)
And: yes, I know I said rename method in a previous post. FSO file object doesn’t have a rename method, it’s move.
’ File thous.vbs begins after this line
set fso = createObject("Scripting.FileSystemObject")
set fold = fso.getFolder("D:\screencaps\ros2")
for each eFile in fold.files
n = eFile.name
if len(n) <= 12 then
newname = left(n, 5) & "0" & right(n, 7)
eFile.move "d:\screencaps\ros2\" & newname
end if
next
msgbox "Done!"