PDA

View Full Version : Random InFlight music



JRJacobs
02-27-2006, 05:34 PM
Here's a little VB script that will randomize your music - I did not create it, I only modified it for IL2.

1st rename all your inflight music.
append/paste any three numbers in FRONT of the wav file. (i used "123-")

Paste the following into a text file
__________________________________________________ _________________

const FilesSubdir="samples\Music\InFlight"
Napis = "InFlight Randomizer for IL2 "& dirtobecleaned &"?"
Titulek = "Windows Scripting Host"
Dim intDoIt
Dim fso, fold, ffil, ffilact, num

Randomize
Call Welcome()

Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder(Fso.getAbsolutePathName("")& "\" & Filessubdir)
Set ffil = fold.Files
For Each ffilact in ffil
num=int(rnd*999)
ffilact.move(fold.path & "\" & string(3-len(cstr(num)),"0") & cstr(num) & right(ffilact.name,len(ffilact.name)-3))
Next

msgbox "Run IL2 and Enjoy"

Sub Welcome()
intDoIt = MsgBox(Napis, vbOKCancel + vbinformation, Titulek )
If intDoIt = vbCancel Then WScript.Quit
End Sub

__________________________________________________ ___

Close and save the text file
Place it into your "IL-2 Sturmovik Forgotten Battles" folder and rename it IL2RandomMusic.vbs (the name's not important the vbs is)
right-click on IL2RandomMusic.vbs select copy, then right-click on your desktop and select create "shortcut".

Now BEFORE you start IL2 run the shortcut and it will RANDOMIZE the first three numbers.

If only I could figure this out as a CMD file

JRJacobs
02-27-2006, 05:34 PM
Here's a little VB script that will randomize your music - I did not create it, I only modified it for IL2.

1st rename all your inflight music.
append/paste any three numbers in FRONT of the wav file. (i used "123-")

Paste the following into a text file
__________________________________________________ _________________

const FilesSubdir="samples\Music\InFlight"
Napis = "InFlight Randomizer for IL2 "& dirtobecleaned &"?"
Titulek = "Windows Scripting Host"
Dim intDoIt
Dim fso, fold, ffil, ffilact, num

Randomize
Call Welcome()

Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder(Fso.getAbsolutePathName("")& "\" & Filessubdir)
Set ffil = fold.Files
For Each ffilact in ffil
num=int(rnd*999)
ffilact.move(fold.path & "\" & string(3-len(cstr(num)),"0") & cstr(num) & right(ffilact.name,len(ffilact.name)-3))
Next

msgbox "Run IL2 and Enjoy"

Sub Welcome()
intDoIt = MsgBox(Napis, vbOKCancel + vbinformation, Titulek )
If intDoIt = vbCancel Then WScript.Quit
End Sub

__________________________________________________ ___

Close and save the text file
Place it into your "IL-2 Sturmovik Forgotten Battles" folder and rename it IL2RandomMusic.vbs (the name's not important the vbs is)
right-click on IL2RandomMusic.vbs select copy, then right-click on your desktop and select create "shortcut".

Now BEFORE you start IL2 run the shortcut and it will RANDOMIZE the first three numbers.

If only I could figure this out as a CMD file

Major_V
02-27-2006, 08:23 PM
Thanks very much for posting this, JR. Works like a charm.

Major V

JRJacobs
02-27-2006, 08:44 PM
http://forums.ubi.com/groupee_common/emoticons/icon_smile.gif y/w

DoubleTap2005A
02-28-2006, 04:29 AM
Awesome tool! Looking for something like this for a while, thanks. I'll try it out.