Jump to content

Recommended Posts

Posted

i know its probably a simple fix but i cant figure out why the msgbox is returning a numeric value instead of a filename...

$FileList=_FileListToArray("./","*.mp4",1)
$end = $filelist[0]
$x = random (1,$end,1)
$name = $filelist[$x]
MsgBox (4096,"",$name)
Posted (edited)

_FileListToArray could be at error and returning 0

i should have said its not returning 0...there are 21 mp4 files and it is returning randomly 1-21...

i just need it to return a random filename not a random number...

also tried uncapitalizing the 1 F and no change...

Edited by supadodger
Posted

supadodger,

your posted script works fine for me. The MessageBox shows a random filename every time I start the script!

(I only changed the search pattern)

#Include <File.au3>
#Include <Array.au3>

$FileList=_FileListToArray("./","*.*",1)
$end = $filelist[0]
$x = random (1,$end,1)
$name = $filelist[$x]
MsgBox (4096,"",$name)

A-Jay

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

the script works fine for me too

i think you can use you can use _ArrayDisplay($filelist, "") to check the return value of _FileListToArray and see if it fails

Posted

supadodger,

your posted script works fine for me. The MessageBox shows a random filename every time I start the script!

(I only changed the search pattern)

#Include <File.au3>
#Include <Array.au3>

$FileList=_FileListToArray("./","*.*",1)
$end = $filelist[0]
$x = random (1,$end,1)
$name = $filelist[$x]
MsgBox (4096,"",$name)

A-Jay

if i leave it at *.* its displaying filenames but if i make it *.mp4 its giving me numbers hmmm

at least im making progress...

Posted

Okay, I changed search pattern back to *.mp4 and I created some .mp4 files in the script directory --- and: Works fine!

Compiled and uncompiled works.

WinXP x86

AutoIt 3.3.4.0

hmm....

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

Come on, John... for testing the script it is not necessary to have "real" .mp4-files. The right filename will do it ;)

A-Jay

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

I'm still lol'ing!

I see your collection of eggs has grown

Hell yeah, new UnCommon eggs each time.

Not all are my though, im sharing with my girlfriend ;)

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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
×
×
  • Create New...