richtburkhart

Syntax Error

3 posts in this topic

I'm getting the syntax error: "Statement cannot be just an expression."

Here's the piece of code where it occurs:

$Check = WinExists("MySQL Installer")
    If $Check <> "" Then
        WinClose("MySQL Installer")
    Else $Check = ControlGetHandle("", "&No", '[CLASS:Button; INSTANCE:2]')
        If $Check <> "" Then
            ControlClick("", "&No", '[CLASS:Button; INSTANCE:2]')
            Sleep(10000)
            WinClose("MySQL Installer")
        EndIf
    EndIf

Anyone know why this error is occurring?

Share this post


Link to post
Share on other sites

You can't have that statement after Else.

This should work:

$Check = WinExists("MySQL Installer")
If $Check <> "" Then
    WinClose("MySQL Installer")
Else
    $Check = ControlGetHandle("", "&No", '[CLASS:Button; INSTANCE:2]')
    If $Check <> "" Then
        ControlClick("", "&No", '[CLASS:Button; INSTANCE:2]')
        Sleep(10000)
        WinClose("MySQL Installer")
    EndIf
EndIf

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Haha how was I so blind? Of course I can't do that. Thanks so much, Jos.

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

  • Similar Content

    • Fr33b0w
      By Fr33b0w
      Func z009() If FileExists("search\009\009.au3") Then #include <search\009\009.au3> EndIf EndFunc This wont work...  Is there any workarround for this or I should do it in a different way?
       
    • chacoya121
      By chacoya121
      can anyone help me plz
      how can you put mouseclick in if statement or is it possible
      example:
      if Mouseclick = "left" then Tooltip(" you click left mouse") thank you
    • ur
      By ur
      I have an exe with name "erwin Data Modeler r9.7 (32-bit)_2332.exe"
       
      THe lat 4 digits 2332 may vary and also the version number r9.7 also might vary.
      So, how to write a generic expression so that the exe can be picked from the current directory {with any version (9.7 or anything) and any build number (2332 or anything)}
       
      Thanks in Advance
    • Kyan
      By Kyan
      Hey everyone
      I'm stuck with this regular expression, for matching a iso standard version
      what I want to do is match the text in green: ISO 11784:1996/Amd.2:2010(E)
      there is also others that look like this: ISO 11789:1999(E), and without the (E) part,
      Só I did this one
       (?i)ISO.+?[\d-]+:(?:\d+/Amd.+?:)?[\d-]+(?:\(\w\))* to match both cases but doesn't ignore the text in red
      Can somebody point out what I'm doing wrong here?
       
    • kashamalasha
      By kashamalasha
      Hi everybody.
      Could you tell me is there any UDF that can help to highlight syntax in the _GUICtrlRichEdit element on the fly?
      Is it possible to implement this feature in script in simple way using some UDF or something, instead of writing thousand of strings manually?
      Thanks in advance.