Jump to content

Randomly start a file?


Recommended Posts

Hi! First post here, Great show, great forum!

I just got a remote control for my pc (ATI Remote Wonder 2) And im going to use this to control winamp, video etc.

There are 6 buttons that you can customize on this remote, i have placed a winamp playlist file to start when i press on one of these buttons. But i want to have more that just 6 playlists. So i got this idea.

I'm looking for a program that can start a file randomly from a specific folder.

This way i can just attach this randomizer program to one of the buttons on the remote. And just press it some this to get different playlists from this folder.

It could just be a exe called random.exe that i put in the same dir as the .pls files and when i run this it starts one of the files in this dir.

Or is it possible to do this via a bat script?


Link to comment
Share on other sites

Copy and paste the code into a .vbs file in the directory of your playlist.

Dim oFolder

Dim oFile

Dim iCount

Dim Random

ReDim szaFiles(0)

Set wshShell = CreateObject("WScript.Shell")

Set FSO = CreateObject("Scripting.FileSystemObject")

Set oFolder = FSO.GetFolder(".")

For Each oFile In oFolder.Files

  iCount = UBound(szaFiles) + 1

  ReDim Preserve szaFiles(iCount)

  szaFiles(iCount) = oFile.Path



Random = Int((iCount) * Rnd + 1)

wshShell.Run chr(34) & szaFiles(Random) & chr(34)

Then just have your remote call the .vbs file.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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