if statements regressed in 2.0.6

  • tomuo

    tomuo - 2011-10-08

    Trying to use a simple if statement in a script

    Compareto "desired.png"
    if ({_COMPARETO_RESULT} != 100) {
         Mouse click to=x:138,y:83 wait 900

    The code runs as expected in Robot 2.0.5,   but in 2.0.6 the if line is flagged as a syntax error and is never evaluated.
    The syntax error popup help doesn't appear for this line either, it's just underlined in red and won't be used.

  • Robert Pes

    Robert Pes - 2011-10-10

    I put the code above into a new v2.0.6 script. The only syntax error reported by the editor was the invalid "wait" parameter in the Mouse command (must be "wait=900" instead of "wait 900"). Once this had been fixed the script compiled without any errors and it also executed correctly.

    Am I missing something?

  • tomuo

    tomuo - 2011-10-10

    Apart from the wait=900 typo, this is what is failing.
    I re-downloaded 2.0.6 from sourceforge to double check I had the real 2.0.6, and its the same.
    Running on Windows XP, latest Java runtime.
    If I leave the test script showing in the window, close 2.0.6, and then open 2.0.5, the error goes away.  Close and reopen with 2.0.6 and the redline comes back.

    The if line is underlined, but there is no error message
    The closing bracket for the if statement is also red-lined with "Incorrectly terminated end of a block - '}' expected"

    I tried with various scripts from the examples on the t-plan website too, these all have redline errors on all "ifs"

  • tomuo

    tomuo - 2011-10-10

    I checked on a Mac running OS X 10.6.8 to see if it was related to the Java runtime.

    Same results - 2.0.6. flags the if line as an error, 2.0.5 doesn't.


  • tomuo

    tomuo - 2011-10-10

    Screen shot of error as I see it:

    I'm using the .jar file that is in the sourceforge downloaded zip file, not a local compile of the java source, if that makes a difference.

  • Robert Pes

    Robert Pes - 2011-10-12

    Thanks for all the data!

    I confirm that I'm able to reproduce the problem when I save the above code to a file, restart Robot and reopen it. Though the cause of this problem is not yet known, it is not reproducible with the latest source code and it will be fixed by the 2.0.7 release (no schedule yet, sorry).

    The only workarounds I can suggest at the moment are:
      1. Downgrade to 2.0.5 until 2.0.7 gets released,
      2. Get the latest source code and build your own version.


  • tomuo

    tomuo - 2011-10-12

    Thanks, I need to learn how to use the JDK anyway, so I'll compile from source.

  • Kleber

    Kleber - 2012-01-10


    Could you tell me if you could fix this bug the IF / ELSE …
    If you have any news could help me?


  • Robert Pes

    Robert Pes - 2012-01-12

    The 2.0.7 release hasn't been scheduled yet because we are busy with the upcoming T-Plan Robot Enterprise 3.0.

    Is it a problem to use the 2.0.5 version instead? There is not a big difference in functionality between 2.0.5 and 2.0.6.

  • Robert Pes

    Robert Pes - 2012-04-14

    FYI, I released the 2.0.7 version today which contains a fix of the bug above.

  • Leah Klearman

    Leah Klearman - 2012-04-20

    I just upgraded to 2.0.7 as per your recomendation and the problem is still happening to me. I am running on OSX Lion.


  • Leah Klearman

    Leah Klearman - 2012-04-20

    Downgrading to 2.0.5 did solve the problem…hopefully I won't run into whatever caused 2.0.6 to be released =).

  • Robert Pes

    Robert Pes - 2012-04-20

    Strange… I pasted your example into a 2.0.7 editor and no error was reported. I even executed it to check whether the script jumps to the appropriate if/else branch and everything worked OK.

    Anyway, if you're happy with 2.0.5 just stick to it…

  • tomuo

    tomuo - 2012-12-21

    Belated, but good news.

    2.0.7 didn't fix the problem.   2.0.8 did.       


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks