Jump to content

Bug? Called with wrong number of Arguments


CT83
 Share

Recommended Posts

I am trying to call a function with 7 arguments and when i do so, it says i called with only 6. When I add another argument, it says called with 8 arguments max is 7. PS this code runs just fine when I use it out of my MainProgram.au3  in a separate Temp.au3. But when i use it with the rest of my Functions it keeps returning the errors. 

;TEMP.AU3
Global $LoginTextField[2]
$LoginTextField[0]=1
$LoginTextField[1]=23
CustomClick("videoz","","","left",2,$LoginTextField[0],$LoginTextField[1]) ;clicking Login field

Func CustomClick($sTitle,$sText,$sControlId,$sButton,$iClicks,$iX,$iY)
ConsoleWrite("C. Clicking " &"("& $iX &","& $iY &")")
    Local $OffSetX=0
    Local $OffSetY=0
    ControlClick($sTitle,$sText,$sControlId,$sButton,$iClicks,$iX+$OffSetX,$iY+$OffSetY)
    MouseMove($iX+$OffSetX,$iY+$OffSetY)
EndFunc

Note: I pasted the exact same code in my MainProgram.au3 with minor changes like initialising the variable by a function (yes there is no problems with initilisation, I rechecked) and Declaring variables in separate functions and calling them in separate functions. There are no conflicts, variables of same name or similar stuff. 

Note2: The EXACT same code compiles fine on my PC2, (both have the recommeded autoit installed, updated, both are windows 10, amd and 64 bits)

Is this a bug in autoit? 

Because previously, I had a similar problem with another function, which used to return errors saying wrong number of arguments while compiling on my PC1 but on PC2 the same EXACT code compiled without any issues.

Then the program, compiled fine on PC1 too the next morning after a Reboot and stuff

Has this happened with anyone before?

Link to comment
Share on other sites

Just now, InunoTaishou said:

Could you be calling the CustomClick function in a different section?

Hmm, Nope CustomClick is called sucessfully several times by many other functions from different places without any issues. and as I said, the code compiles fine on a different PC with same version of autoit installed. If it was a error, it shouldnt have compiled and executed. :( 

Link to comment
Share on other sites

1 hour ago, InunoTaishou said:

And this compiles and executes fine on mine as well. Could you post your whole script since this replicator does not replicate the actual issue.

Did Scite error and tell you the line number where the function call failed with incorrect # of arguments?

That's the weird part, I cannot send the whole script coz it's 2000 lines of code and closed source, and when I use the modules which return error, separately without the other code it works and when I add other code to it it doesn't compile on PC1 Bt in PC2 It works fine ! Same exact code errors on one of PC and none on the other ...how Is this possible?! 

 

And yes editor told me which line it's the customclick line which works fine, (when u tested)

Edited by CT83
Link to comment
Share on other sites

2 hours ago, CT83 said:

That's the weird part, I cannot send the whole script coz it's 2000 lines of code and closed source,

Most times a variable is twice used. So read: https://www.autoitscript.com/wiki/Best_coding_practices if you need further help, you can also make a runable (as small as possible) reproducer script, showing the issue(s).

Edited by AutoBert
Link to comment
Share on other sites

  • Developers

The error is likely from au3check on the PC where you get the error and the other PC doesn't run au3check?

In that case: Check all line that call  CustomClick() as au3check won't always be able to tell you the exact line in error since it does a single pass.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

3 minutes ago, Jos said:

The error is likely from au3check on the PC where you get the error and the other PC doesn't run au3check?

In that case: Check all line that call  CustomClick() as au3check won't always be able to tell you the exact line in error since it does a single pass.

Jos

OMG!:drool: Jos u truly are the jedi! o:), Yes indeed! a single line was calling the function with incorrect number or arguments and Au3Check wasn't telling the line number correctly! Thank u so much! Thank you everyone for your help 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...