Computing.Net > Forums > Programming > Script to randomly play vid file from folder

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script to randomly play vid file from folder

Reply to Message Icon

Name: pball
Date: May 27, 2009 at 19:58:01 Pacific
OS: Windows XP
CPU/Ram: 2.8 ghz / 2 gig
Product: Home made / NONE
Subcategory: General
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: May 28, 2009 at 13:35:47 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Script to randomly play vid file from folder

copy files from folder A to folder B .... www.computing.net/answers/programming/copy-files-from-folder-a-to-folder-b-/20177.html

script to copy specify date file to www.computing.net/answers/programming/script-to-copy-specify-date-file-to/17662.html

Deleting a file from many folder www.computing.net/answers/programming/deleting-a-file-from-many-folder/18058.html