Thanks, Richard - that took care of the error in fine style.
When running the code below, which is an evolution of my original post, $RANDOM behaves as expected, but $FILE always returns the first file in the directory. Why might this be happening?
Another oddity - it seems that my RND call is simply incrementing on successive executions, rather than generating random output. What's going on there?
Code:
Break On
$dummy=SetOption('NoVarsInStrings','On')
$dummy=SetOption('Explicit','On')
Dim $FILE_ARRAY,$RANDOM,$FILE_ARRAY_ELEMENT,$FILE
Randomize() ;Randomize() @ KiXtart.org - http://tinyurl.com/7ue38
$File_Array=DirPlus('c:\windows\media','/a-d') ;DirPlus() @ KiXtart.org - http://tinyurl.com/83qoy
$Random=Rnd(Ubound($File_Array))
$File_Array_Element=$File_Array[$Random]
$File=$File_Array[$File_Array_Element]
? 'Element=' + $Random
? 'File=' + $File
Sleep 0.5
Quit