quaizywabbit Posted August 6, 2005 Share Posted August 6, 2005 (edited) ...where N is unknown Not sure how to approach this situation....anyone got an example? Edited August 6, 2005 by quaizywabbit [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
GaryFrost Posted August 6, 2005 Share Posted August 6, 2005 (edited) might try an array Edited August 6, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
quaizywabbit Posted August 6, 2005 Author Share Posted August 6, 2005 (edited) was hoping for a link to an example where that kind of situation could exist.. Edited August 6, 2005 by quaizywabbit [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
GaryFrost Posted August 6, 2005 Share Posted August 6, 2005 i've done it before in vb, but not any other language. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
/dev/null Posted August 6, 2005 Share Posted August 6, 2005 (edited) was hoping for a link to an example where that kind of situation could exist..<{POST_SNAPBACK}>what about this?dim $params[5] $params[0] = 4 $params[1] = "Joe" $params[2] = 4 $params[3] = 3.1415 $params[4] = true mycode($params) func mycode(byref $paramarray) local $n for $n=1 to $paramarray[0] msgbox(0,"INFO", "Param #" & $n & ": " & $paramarray[$n]) next endfuncCheersKurt Edited August 6, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
hgeras Posted August 6, 2005 Share Posted August 6, 2005 In case you use _ArrayAdd in your script and N is always unknown cos it changes as the program runs then instead of using this" For $n=1 To $paramarray[0] use this For #n=1 to UBound($paramarray) -1 So that you dont care about how many really the parameters are.... 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...
GaryFrost Posted August 6, 2005 Share Posted August 6, 2005 and don't need the byref unless you plan on being able to change the array in the function. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
/dev/null Posted August 6, 2005 Share Posted August 6, 2005 and don't need the byref unless you plan on being able to change the array in the function.<{POST_SNAPBACK}>I used the byref, because it's faster.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
/dev/null Posted August 6, 2005 Share Posted August 6, 2005 In case you use _ArrayAdd in your script and N is always unknown cos it changes as the program runs then instead of using this"For $n=1 To $paramarray[0]use this For #n=1 to UBound($paramarray) -1So that you dont care about how many really the parameters are....<{POST_SNAPBACK}>If you set $paramarray[0] to contain the size of the array, then Ubound() is not necessary.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
therks Posted August 6, 2005 Share Posted August 6, 2005 I'm not sure he was talking about an array guys. It looked more like he was asking about a function that would need an indefinite amount of parameters, which is not possible in the case of AutoIt. One such example for code like this could be the following (Note, this will NOT work): Func _ArrayCreate() Local $i If @NumParams > 0 Then Local $av_Array[@NumParams] For $i = 0 to @NumParams $av_Array[$i] = FuncGetParam($i); <-- this is a made up function. here it would get the function's parameters based on their index Next Return $av_Array Else Return 0 EndIf EndFunc $a_Fruits = _ArrayCreate('apple', 'orange', 'banana', 'peach') My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
GaryFrost Posted August 6, 2005 Share Posted August 6, 2005 I'm not sure he was talking about an array guys. It looked more like he was asking about a function that would need an indefinite amount of parameters, which is not possible in the case of AutoIt.One such example for code like this could be the following (Note, this will NOT work):Func _ArrayCreate() Local $i If @NumParams > 0 Then Local $av_Array[@NumParams] For $i = 0 to @NumParams $av_Array[$i] = FuncGetParam($i); <-- this is a made up function. here it would get the function's parameters based on their index Next Return $av_Array Else Return 0 EndIf EndFunc $a_Fruits = _ArrayCreate('apple', 'orange', 'banana', 'peach')<{POST_SNAPBACK}>I knew what he meant, I't can be done in vb, and like you said, currently not in AutoIt, therefore I suggested an arrayGary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
therks Posted August 6, 2005 Share Posted August 6, 2005 Oops. My bad, I misread that. Guess I should get some sleep (6:40am).Keeping this post from being completely useless, this can be done in PHP, they have functions that support it.Check it here. I'm going to bed. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
hgeras Posted August 6, 2005 Share Posted August 6, 2005 If you set $paramarray[0]to contain the size of the array, then Ubound() is not necessary.CheersKurtThis is valid if you set the values manualy.But if you use a growing array with _ArrayAdd for instance,then if you save the [0] element for the dimension of the array then everytime he runs _arrayadd he should run in the next line $params[0]=UBound($params) -1 to update the [0] element... So again UBound is needed....It's just one of the ways you can do this... 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...
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