Script to randomly play vid file from folder

Home made / NONE
May 27, 2009 at 19:58:01
Specs: Windows XP, 2.8 ghz / 2 gig
I have a few hundred short videos and I don't want to pick out which ones to watch, cause I'll end up watching my favorites first. So I'm wondering if someone could script something up to pick a random video then open it. Then when done move that to a new directory.

How hard would that be?


See More: Script to randomly play vid file from folder

Report •


#1
May 28, 2009 at 13:35:47
I have an old script (apparently written during some summer break in college) that makes a list of X files Z lines long, called Y. It isn't perfect, but it should get you started.

The command line is: script <what to look for> <output> <desired size of list>
ie: mrandlist c:\videos\*.avi list.txt 50

@echo off
if ()==(%3) exit /b 255
dir /b /s /a-d %1 > "%temp%\listing.txt"
for /f "delims=:" %%a in ('type %temp%\listing.txt ^| findstr /n "."') do @set maxRand=%%a
if exist %2 del %2

for /l %%a in (1,1,%3) do call :output %2

del "%temp%\listing.txt"
goto :eof


:output
set /a rand=(%random% %% %maxRand%) + 1
set /a maxRand -= 1
for /f "tokens=1* delims=:" %%J in ('type "%temp%\listing.txt" ^| findstr /n "." ^| findstr "^%rand%:"') do @echo "%%K">> %*
for /f "tokens=1* delims=:" %%J in ('type "%temp%\listing.txt" ^| findstr /n "." ^| findstr /v "^%rand%:"') do @echo %%K>> "%temp%\listingTMP.txt"
move "%temp%\listingTMP.txt" "%temp%\listing.txt"
goto :eof


Report •
Related Solutions


Ask Question