supadodger Posted August 24, 2010 Share Posted August 24, 2010 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) Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 24, 2010 Share Posted August 24, 2010 (edited) Capitalize the f in the two $filelist lines (2 & 4), or uncapitalize the F in the first line $Filelist. Edited August 24, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
JohnOne Posted August 24, 2010 Share Posted August 24, 2010 _FileListToArray could be at error and returning 0 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
supadodger Posted August 24, 2010 Author Share Posted August 24, 2010 (edited) _FileListToArray could be at error and returning 0i 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 August 24, 2010 by supadodger Link to comment Share on other sites More sharing options...
ajag Posted August 24, 2010 Share Posted August 24, 2010 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) Link to comment Share on other sites More sharing options...
gull Posted August 24, 2010 Share Posted August 24, 2010 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 Link to comment Share on other sites More sharing options...
supadodger Posted August 24, 2010 Author Share Posted August 24, 2010 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... Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 24, 2010 Share Posted August 24, 2010 Sorry to ask an obvious question, but .mp4 files do exist in the scripts directory? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
ajag Posted August 24, 2010 Share Posted August 24, 2010 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) Link to comment Share on other sites More sharing options...
JohnOne Posted August 24, 2010 Share Posted August 24, 2010 I changed search pattern back to *.mp4 and I created some .mp4 files in the script directory AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ajag Posted August 24, 2010 Share Posted August 24, 2010 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) Link to comment Share on other sites More sharing options...
supadodger Posted August 24, 2010 Author Share Posted August 24, 2010 rebooted and works fine... oh well... thanks guys.. Link to comment Share on other sites More sharing options...
AlmarM Posted August 24, 2010 Share Posted August 24, 2010 I lol'd. 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. Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 24, 2010 Share Posted August 24, 2010 I lol'd.I'm still lol'ing!I see your collection of eggs has grown 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
AlmarM Posted August 24, 2010 Share Posted August 24, 2010 I'm still lol'ing!I see your collection of eggs has grownHell 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now