hgeras Posted August 24, 2005 Share Posted August 24, 2005 The functionality is as that: You tell it to to store a new value at the first or the last element and delete the last or first one , depending the direction you chose...So you will have new values and the others will "slide" left or right... You can see a need for application of this function in my NvTempLogger script (check sig) , the Array_Slide_left function...Of course this UDF is more improved since you can choose direction and the new value can also be another array...Consider it the opposite of _ArrayPop UDF.... expandcollapse popup;===================================================================================== ; ; Function Name: _ArrayPush ; Description: Add new values without increasing array size.Either by inserting ; at the end the new value and deleting the first one or vice versa. ; Parameter(s): $avArray - Array ; $sValue - The new value.It can be an array too. ; $i_Direction - 0 = Leftwise slide (adding at the end) (default) ; 1 = Rightwise slide (adding at the start) ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - 0 if $avArray is not an array. ; -1 if $sValue array size is greater than $avArray size. ; In both cases @error is set to 1. ; Author(s): Helias Gerassimou(hgeras) ; ;====================================================================================== Func _ArrayPush(ByRef $avArray, $sValue, $i_Direction = 0) Local $i,$j If (Not IsArray($avArray)) Then SetError(1) Return 0 EndIf If (Not IsArray($sValue)) Then If $i_Direction = 1 Then For $i = (UBound($avArray) - 1) To 1 $avArray[$i] = $avArray[$i - 1] Next $avArray[0] = $sValue Else For $i = 0 To (UBound($avArray) - 2) $avArray[$i] = $avArray[$i + 1] Next Local $i = (UBound($avArray) - 1) $avArray[$i] = $sValue EndIf SetError(0) Return 1 Else If UBound($sValue) > UBound($avArray) Then Seterror(1) Return -1 Else For $j = 0 to (UBound($sValue) - 1) If $i_Direction = 1 Then For $i = (UBound($avArray) - 1) To 1 $avArray[$i] = $avArray[$i - 1] Next $avArray[$j] = $sValue[$j] Else For $i = 0 To (UBound($avArray) - 2) $avArray[$i] = $avArray[$i + 1] Next Local $i = (UBound($avArray) - 1) $avArray[$i] = $sValue[$j] EndIf Next EndIf EndIf SetError(0) Return 1 EndFunc ;==>_ArrayPush I hope you make a good use of it.... C ya Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
busysignal Posted August 29, 2005 Share Posted August 29, 2005 Interesting use of an array.. Cheers.. Link to comment Share on other sites More sharing options...
hgeras Posted August 30, 2005 Author Share Posted August 30, 2005 Thanx busysignal...It is implemented in the new beta too, 1.71. Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
busysignal Posted September 3, 2005 Share Posted September 3, 2005 Sweeet...... Nice to see good code put into the product.. I have to get the latest beta. I know there was a project to check for new beta but not sure where it went. So, I guess I will have to make my own. Thanks for the update.. and will check it out.. Cheers.. Link to comment Share on other sites More sharing options...
hgeras Posted September 4, 2005 Author Share Posted September 4, 2005 hahaha... busysignal... You shouldnt try too much.... Check my sig.... about the program for betas.... Thanx theguy0000 for your comment.... Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
theguy0000 Posted September 5, 2005 Share Posted September 5, 2005 interesting script...nice (i accidentaly deleted my original post ) The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN 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