layer Posted March 31, 2005 Posted March 31, 2005 (edited) Ok, I'm being honest here... I've literally tried for hours... What I'm trying to do, is create a function to play M3U files. It's pretty easy, only if there's one song in the file, but since obviously, most people do not have just one song in a M3U file, I need to create an array. So, here's my 1,023, 678 attempt at it:#include <File.au3> Func _PlayM3U($M3UFilePath) $File = FileOpen($M3UFilePath, 0) Dim $lines $lines = _FileCountLines($M3UFilePath) For $n = 1 to $lines $linestext = FileReadLine($M3UFilePath, $n) Next For $i = 1 to $linestext[$lines] MsgBox(0, "Debug", $linestext[$i]) Next EndFunc ;==>_PlayM3U _PlayM3U(@DesktopDir & "\m3utest.m3u")Now please, instead of re-writing this for me, could you just tell me what I am doing wrong? Because this is for someone, and I need to oficially call it mine... So if someone would point out my errors, that would be great! Thanks a bunch! EDIT: I know, I could use, _FileReadToArray... But I'd like to not_use as much of others peoples work as possible... Edited March 31, 2005 by layer FootbaG
zcoacoaz Posted April 1, 2005 Posted April 1, 2005 (edited) you never dimmed $linestext as an array just set the subscripts to how many lines are in the file Edited April 1, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
zcoacoaz Posted April 1, 2005 Posted April 1, 2005 Ejoc, he specificly said not to post code [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
Ejoc Posted April 1, 2005 Posted April 1, 2005 Ejoc, he specificly said not to post code<{POST_SNAPBACK}>missed that, my bad Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
layer Posted April 1, 2005 Author Posted April 1, 2005 Thanks... I've looked at Ejoc's code, and I now understand a lot more about arrays then I did 10 minutes ago! There's still one thing I don't get, is why, did you have to do this:Dim $linestext[$lines+1]Why was the "+1" inside the brackets, necassary? FootbaG
Ejoc Posted April 1, 2005 Posted April 1, 2005 Because Arrays start at 0 not 1 so and array of 3: Dim $array[3] Would be $array[0], $array[1] and $array[2] Since you are using the line number of the file(which starts at 1) you would then try to access $array[3] which isnt valid. Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
layer Posted April 1, 2005 Author Posted April 1, 2005 Ohhhhh!! Now I get it... Thanks, again! FootbaG
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