Jump to content

random file selector


 Share

Recommended Posts

so here is the quick and dirty. i have a movie collection with almost 1400 movies in a folder. im looking for some help writing a script/program that will randomly select any movie out of this folder and then play the file in VLC media player. i know this isnt an impossible feat as i have successfully written the exact script to do this in my Linux partition, i want a version to do this in windows as well though because i flip flop between linux and windows frequently due to program compatability issues in linux. i also would in addition just like to learn how to write a program like this in windows as well. here is my script from my linux build

cd '/media/2TB Media/01. Movies'

set -- *

length=$#

m=$(( $RANDOM % ($length + 1) ))

vlc --one-instance --volume 1024 "${!m}"

exit 0

now i dont know if i could just input this with a corrected directory structure for my windows build in AutoIT and compile a program. any help or suggestions AT ALL would be greatly appreciated.

Link to comment
Share on other sites

_FileListToArray - to get all your movie names into an array

Random - to get a number between 1 and the maximum number of elements

Play array element number (the one generated by Random function)

That sould get you well started.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

ended up getting this program working fine, still need to add functionality to be able to read files in a subdirectory, right now can only read files in the main directory. ill post the final product and source in a couple days when i get a chance. im open to any suggestions or improvements anybody may have after they check it out

Edited by Haagimus
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...