jaberwacky Posted January 6, 2009 Share Posted January 6, 2009 (edited) Hi, me again...If I had an array like this: http://content.imagesocket.com/images/ArrayDisplay388.jpgCould I make another array that would only include the numbers?Did I explain thoroughly?Matt Edited January 6, 2009 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
DaRam Posted January 6, 2009 Share Posted January 6, 2009 I, perhaps other have the imagesocket.com URL blocked, could you post relevant code?Hi, me again...If I had an array like this: http://content.imagesocket.com/images/ArrayDisplay388.jpgCould I make another array that would only include the numbers?Did I explain thoroughly?Matt Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 6, 2009 Share Posted January 6, 2009 Yes you can make it all numbers. Look up _arraydelete and _isnumber in the help file. That should get you on the right track. Giggity Link to comment Share on other sites More sharing options...
jaberwacky Posted January 6, 2009 Author Share Posted January 6, 2009 Yes you can make it all numbers. Look up _arraydelete and _isnumber in the help file. That should get you on the right track.Hey, sounds good. I'll give a try and report back. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted January 6, 2009 Author Share Posted January 6, 2009 Hey, sounds good. I'll give a try and report back. Ok, as soon as I added _ArrayDelete() into my code it throws this error message: "Array variable has incorrect number of subscripts or subscript dimension range exceeded." I ran the array through isArray() which reports that it is an array! If isArray( $initialArray ) Then msgBox( 0 , "" , "array" ) For $i = 0 to 31 Step 1 If $initialArray[ $i ] = 99 Then _arrayDelete( $initialArray , $i ) EndIf Next Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 6, 2009 Developers Share Posted January 6, 2009 When you perform the _ArrayDelete(), the array will have one "record" less, but you are not adapting $i. To avoid this problem you need to process your array in the reverse direction: If isArray( $initialArray ) Then msgBox( 0 , "" , "array" ) For $i = 31 to 0 Step -1 If $initialArray[ $i ] = 99 Then _arrayDelete( $initialArray , $i ) EndIf Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 6, 2009 Share Posted January 6, 2009 (edited) Hmmm Jos I never thought of doing it that way. Also wouldn't it make it quicker if you added a $i -= 1 so that it doesn't read the same item twice? Edit: I always put a $i -= 1 in there so it doesn't skip an item and have if @error then exitloop Edited January 6, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
jaberwacky Posted January 6, 2009 Author Share Posted January 6, 2009 It just now occurred to me! This is the idea I had to deal with the problem: For $i = 0 to UBound( $initialArray ) - 1 Step 1 If $initialArray[ $i ] = 0 Then _ArrayDelete( $initialArray , $i ) Next I'm going to try it now... Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 6, 2009 Developers Share Posted January 6, 2009 (edited) Hmmm Jos I never thought of doing it that way. Also wouldn't it make it quicker if you added a $i -= 1 so that it doesn't read the same item twice? Edit: I always put a $i -= 1 in there so it doesn't skip an item and have if @error then exitloop"there are many roads leading to Rome" but in general you would use: For $i = 0 to Ubound($initialArray)-1 or For $i = 0 to Ubound($initialArray[0]) Using this would always trigger the error as the For values are only initially set. That is why I normally go for the reverse approach. Jos Edited January 6, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 6, 2009 Share Posted January 6, 2009 I thought the saying was all roads lead to Rome? I prefer "There's more then one way to skin a cat" Giggity Link to comment Share on other sites More sharing options...
jaberwacky Posted January 6, 2009 Author Share Posted January 6, 2009 (edited) I tried the UBound() method. Then I tried: For $i = 31 to 0 Step 1 If $initialArray[ $i ] = 0 Then _ArrayDelete( $initialArray , $i ) EndIf Next That stopped the error message but doesn't delete the elements from the array! Edited January 6, 2009 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 6, 2009 Share Posted January 6, 2009 You stepping the wrong way. 31 + 1 continued will never = 0. Giggity Link to comment Share on other sites More sharing options...
jaberwacky Posted January 6, 2009 Author Share Posted January 6, 2009 You stepping the wrong way. 31 + 1 continued will never = 0.Giggity Giggity! I just now realized it and that fixed the prob!!! Thanks to all posters for taking the time! =D Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 6, 2009 Developers Share Posted January 6, 2009 I thought the saying was all roads lead to Rome? I prefer "There's more then one way to skin a cat"This particular saying has 2 versions:1. Alle wegen leiden naar Rome2. Vele wegen leiden naar RomeTranslated 1. is your version and 2. is mine. .. and we never skin cats overhere. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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