magaf Posted August 25, 2004 Posted August 25, 2004 i think thats the problem... the error i get is "Incorrect number of parameters in function call" the code is: if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]]), "a")
SlimShady Posted August 25, 2004 Posted August 25, 2004 if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]]), "a") should be... if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]], "a")
magaf Posted August 25, 2004 Author Posted August 25, 2004 after if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]], "a") i call a function and i want it to take the variable i made there so i use Eval ($x[$x[0]]) as the parameter i send and in the function i take it ByRef when i did that it gave me an error: "Expected a variable in user function call." why is that? there should be a variable already...
this-is-me Posted August 25, 2004 Posted August 25, 2004 IsDeclared requires the NAME of the variable to be quoted in the function: $x = 4 msgbox(0, "", IsDeclared("x") Notice no $x in the function, but instead just x in quotes. For your particular problem, therefore, it will not work because you have an array. Who else would I be?
SlimShady Posted August 25, 2004 Posted August 25, 2004 (edited) after if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]], "a") i call a function and i want it to take the variable i made there so i use Eval ($x[$x[0]]) as the parameter i send and in the function i take it ByRef when i did that it gave me an error: "Expected a variable in user function call." why is that? there should be a variable already... <{POST_SNAPBACK}>What did you call the variable? You have to use a real variable in the header of the function. Example: Func TestFunc($a, $b) If $a <> "" AND $b <> "" Then ;Do stuff EndIf EndFunc I don't understand exactly how ByRef works, so I can't help you with that. Edited August 25, 2004 by SlimShady
magaf Posted August 25, 2004 Author Posted August 25, 2004 (edited) ... me too i dont know what byref can change in the fact that it worked before i putted it on byref and i did use it like in your example... Edited August 25, 2004 by magaf
magaf Posted August 25, 2004 Author Posted August 25, 2004 ive had to use another way less efficient way to make my program work but still from what ive seen, with autoit its impossible to use a variable as an array's name...
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