beestinga Posted September 18, 2008 Share Posted September 18, 2008 Searching around, I found a few places that people were requesting such features as _ArraySum, _ArrayMult, etc. did such a tool ever come to fruition. It would be nice to be able to add a number to all elements of an array, or to add two arrays together with a single function. I'm most interested in multi-dimensional arrays, but i could see single dimension arrays benefiting from this as well. -Stinga Link to comment Share on other sites More sharing options...
Community On Patrol Posted September 18, 2008 Share Posted September 18, 2008 Hi beestinga, Please create descriptive topics. Using one word topics makes it really difficult to use the search feature, and those that could probably answer your question will probably not even read your thread. Doing it enough could cause your posting privileges to be taken away all together, and we don't want that . Thanks. Link to comment Share on other sites More sharing options...
beestinga Posted September 18, 2008 Author Share Posted September 18, 2008 Hi beestinga,Please create descriptive topics.Using one word topics makes it really difficult to use the search feature, and those that could probably answer your question will probably not even read your thread.Doing it enough could cause your posting privileges to be taken away all together, and we don't want that .Thanks.Is this a bot? Link to comment Share on other sites More sharing options...
Szhlopp Posted September 18, 2008 Share Posted September 18, 2008 Is this a bot?Yes it is... But I wouldn't get all upset about it(Trust me).To answer your question I've never seen anything like "Arraysum"Try forum searching. Somebody here might have some old UDF that does the trick too. Let's just hope... RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
DjDeep00 Posted September 18, 2008 Share Posted September 18, 2008 (edited) @beestinga...Make your own UDF...Here is what I would do... #include <Array.au3> $String="1,2,3,4,5" $Array=StringSplit($String,",") $Sum=0 For $x=1 to UBound($Array)-1 $Sum=$Sum+$Array[$x] Next MsgBox(4096,"",$Sum) Or #include <Array.au3> $String="1,2,3,4,5" $Array=StringSplit($String,",") $Total=_ArrayToString($Array,"+",1) $Sum=Execute($Total) MsgBox(4096,"",$Sum) Edited September 18, 2008 by DjDeep00 Link to comment Share on other sites More sharing options...
beestinga Posted September 18, 2008 Author Share Posted September 18, 2008 @beestinga...Make your own UDF...Here is what I would do... #include <Array.au3> $String="1,2,3,4,5" $Array=StringSplit($String,",") $Sum=0 For $x=1 to UBound($Array)-1 $Sum=$Sum+$Array[$x] Next MsgBox(4096,"",$Sum) Or #include <Array.au3> $String="1,2,3,4,5" $Array=StringSplit($String,",") $Total=_ArrayToString($Array,"+",1) $Sum=Execute($Total) MsgBox(4096,"",$Sum) Thanks, DjDeep for your ideas. I guess I'll need to whip something up. -Jason Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 18, 2008 Moderators Share Posted September 18, 2008 (edited) The time it took you to post you could have done:Func _ArraySum(ByRef $a_array, $i_lbound1 = 0, $i_lbound2 = 0) Local $i_ubound1 = UBound($a_array, 1) - 1 Local $i_ubound2 = UBound($a_array, 2) - 1 Local $i_add = 0 If $i_ubound2 > 0 Then For $i = $i_lbound1 To $i_ubound1 For $n = $i_lbound2 To $i_ubound2 $i_add += Number($a_array[$i][$n]) Next Next Else For $i = $i_lbound1 To $i_ubound1 $i_add += Number($a_array[$i]) Next EndIf Return $i_add EndFuncBot or no bot, 1 word titles are annoying. There are two parts to a title... The title, and a description. Edited September 18, 2008 by SmOke_N 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. 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