SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   Silent Hunter III (https://www.subsim.com/radioroom/forumdisplay.php?f=182)
-   -   GWX KC Edition Gramophone Randomizer (https://www.subsim.com/radioroom/showthread.php?t=258340)

Mowgli 03-09-25 03:20 PM

GWX KC Edition Gramophone Randomizer
 
To randomize the ogg files in your gramophone directory.
First backup your tracks to another folder.
Cut and copy the code below into a new notepad file and save any name you like with a .bat extension.
Save in your gramophone folder.
I then created a shortcut on my desktop to to run it from there or you can go into the folder and run it from there also before starting your SH3 session.
I am been running it for some time now and it is fine with 58 ogg files. I shall be adding more. Here is the code, I accept no responsibility if you have a problem.
Please note you will lose original file names and new "names" will be generated each time the bat file is run.

@@echo off
setlocal enabledelayedexpansion

:: Define directory (change if needed)
set "music_dir=%CD%"

:: Change to the directory with the OGG files
cd /d "%music_dir%"

:: Create a temporary file list
set "tmpfile=randomlist.tmp"
dir /b *.ogg > "%tmpfile%"

:: Loop through each file and rename it with an 8-digit random number
for /f "tokens=*" %%A in (%tmpfile%) do (
set /a randnum=!random! * 100000 + !random! %% 100000
ren "%%A" "!randnum!.ogg"
)

:: Clean up temp file
del "%tmpfile%"

echo Files randomized successfully with fixed-length filenames.
pause

Doolar 03-11-25 11:56 AM

Thank You
 
Thanx, much needed, I have about 620 selections and only the first tunes, over and over.

Doolar 03-11-25 03:10 PM

Thank you Again
 
Works perfectly. If ya ever find yourself in CA45 (Baltimore Md), I owe ya a beer

Mowgli 03-13-25 09:52 AM

Your welcome
 
Quote:

Originally Posted by Doolar (Post 2948165)
Works perfectly. If ya ever find yourself in CA45 (Baltimore Md), I owe ya a beer

My pleasure, I also like listening to music and songs on patrol.

:Kaleun_Cheers:


All times are GMT -5. The time now is 03:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.