=sinister= Posted July 29, 2008 Share Posted July 29, 2008 I tired For $i = 0 To UBound($Keys) _ArrayDelete($Keys, $i) Next But it always leaves 1 value from the Array (The second value). Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 29, 2008 Share Posted July 29, 2008 To delete everything in an array, just say $var = 0. Then the array is gone. Link to comment Share on other sites More sharing options...
=sinister= Posted July 29, 2008 Author Share Posted July 29, 2008 (edited) LOL! A lot more simple than what I had in mind. I made a "Temp" value, then inserted a value, then deleted the "Temp" value. Now I just delete that Array and create a new one, thanks. Edited July 29, 2008 by =sinister= Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 29, 2008 Share Posted July 29, 2008 Sometimes the simplest answer is the hardest to find. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 29, 2008 Share Posted July 29, 2008 I tired For $i = 0 To UBound($Keys) _ArrayDelete($Keys, $i) Next But it always leaves 1 value from the Array (The second value). Your current issue is solved, thanks to Richard, but you have other problems here that will bite you in the future: Any time you will be walking an array deleting elements, you should be working through it BACKWARDS because deleting an element changes the index number of the following elements. Also, Ubound() returns the 1-based count of elements, but array are 0-based requiring the use of "Ubound($avArray) - 1". So, though the point is moot for now, your code should have been: For $i = UBound($Keys) - 1 To 0 Step -1 _ArrayDelete($Keys, $i) Next As Richard showed, this is not the easiest way simply delete the array, but when you want to selectively delete SOME elements, this technique is required to avoid errors. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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