sandyd Posted October 2, 2006 Posted October 2, 2006 Hi all,Having a bit of a problem getting my head round array. See the following code:#include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0])A file with lots of words begining with the letter A is read. I then try to filter them down by searching for the first 3 letters to be add. When I try to display the results, it cant determine the number of items in the array. I have checked by outputting $As[0] which shows blank.Any ideas? ----[ SandyD ]---
Moderators SmOke_N Posted October 2, 2006 Moderators Posted October 2, 2006 Hi all, Having a bit of a problem getting my head round array. See the following code: #include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0]) A file with lots of words begining with the letter A is read. I then try to filter them down by searching for the first 3 letters to be add. When I try to display the results, it cant determine the number of items in the array. I have checked by outputting $As[0] which shows blank. Any ideas?If the msgbox is not there, then you probably have too much information to display... Use Ubound($As) - 1 instead of $As[0] and see what you get Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
xcal Posted October 2, 2006 Posted October 2, 2006 Hi all, Having a bit of a problem getting my head round array. See the following code: #include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0]) oÝ÷ Øâì"¶h¶ÊÂݱ· x§Ø^ëmz°"²·taz{kÊÚ[^®Ø^Ú0¼¬yªÜ)à~íçâ®Ëwëmz»-¡·¢Z+£}úé÷쥩ì·)^ How To Ask Questions The Smart Way
sandyd Posted October 2, 2006 Author Posted October 2, 2006 Cheers for the replies, I think I'll stick with UBound, more generic and less for me to worry about. ----[ SandyD ]---
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