Sign in to follow this  
Followers 0
czardas

Inconsistant comparison of variables.

3 posts in this topic

Hello I'm new here. I've been using an older version of AutoIt3 to automate MS Excel. No problem there. I do, however, have a problem with AutoIt3's lack of consistancy in comparison of variables. I admit that I ought to update to the most recent version and intend to do so, eventually. In the mean time I have a case of severe time pressure and about 3000 comands to keep in check and another fifteen hundered or so to write within the next few days, [seriously]. So my question is: howcome a logical argument can sometimes be followed and at other times not? If I compare $varA with $varB in the following way:

'If $varA > $varB Then'

I sometimes get the correct return value and the script runs perfectly. At other times, it gets it the wrong way around. For a while I have been putting up with the inconvenience of writing the following statement.

'If $varA + 0 > $varB Then'

This sometimes seems to kickstart AutoIt3 into following the correct argument, but not always. Anyhow I don't personally see a difference in these two statements. I have tried other constructions with inconsistant results. e.g.

'If $varB + 0 < $varA Then' etc...

What is going on? Is this a bug or am I missing something? Is there a simple way to circumvent the problem of having to write illogical sequences to produce the desired result. I hope that you can advise me soon. I think that on the whole AutoIt3 is brilliant, but when you're over the half way line, you simply have to keep swimming to the other side. I need some support [quick].

Share this post


Link to post
Share on other sites



Do you get any error messages?

Variables not declared or anything of the like?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I avoid using too many variables wherever possible. Undeclared variables are not the problem. OK I sometimes get myself tangled up in complicated arguments and make mistakes. I have, just now, found an error in my partially finished script and can proceed further. However it is still a mystery to me why I get a different result if I add a zero to a variable. Perhaps it is my error. If anyone else has come across this before then I would like to know how they resolved the issue. I hope that the updated version of AutoIt doesn't do this when I have the time to upgrade. I believe that I will be able to simplify my script with the newer version.

My panic is due to the fact that I have to deliver details of my income (as a self employed musician) within a given time frame or else face complications. I hate double entry bookkeeping and can never get the books to balance. With AutoIt I can check the balance after each entry within a fraction of a second. Because of the nature of my sales and expenses, I have to produce a very flexible script which can take all eventualities into account. Changes in groups of students, prepayments, arrears and lots of other boring stuff. Instead of doing my books I have invested the last 10 days in writing sections of script that deal with these changes individually. I know that I can simplify my script, but right now I just need a working number cruncher which avoids me making errors of entry and decides whether students exist or not and thier current standing as regards payments, number of lessons, payments by cash or cheque etc...

Edited by czardas

Share this post


Link to post
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
Sign in to follow this  
Followers 0