Jump to content
richtburkhart

Syntax Error

Recommended Posts

richtburkhart

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
Jos

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


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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
richtburkhart

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

    • ergo
      By ergo
      CronToTime.au3 UDF converts a Unix Cron expression into a DateTime string.
      On Unix systems a Cron expression made of five fields separated by blanks/tabs followed by a shell command to execute.

      e.g. 15-30 2,3,4,5 29 1-12 0-6 reboot
      +------------- minute (0 - 59)
      ¦ +------------- hour (0 - 23)
      ¦ ¦ +------------- day of month (1 - 31)
      ¦ ¦ ¦ +------------- month (1 - 12)
      ¦ ¦ ¦ ¦ +------------- day of week (0 - 6) (Sunday to Saturday, 7 is also Sunday)
      ¦ ¦ ¦ ¦ ¦ +------------- some shell command
      ¦ ¦ ¦ ¦ ¦ ¦
      ¦ ¦ ¦ ¦ ¦ ¦
      * * * * * reboot
      (In this UDF the 6th field has no meaning and no influence on the result).
      For more information see https://en.wikipedia.org/wiki/Cron

      Finds the next event of the specified Cron expression, starting from current UTC/GMT.
      _pce_findNextTimeUTC($sCronExp [, $bForwardSearch = True [, $minutesOffset = 0]]])
      Finds the next event of the specified Cron expression. If $sDateTime is not set, local time will be used.
      _pce_findNextTime($sCronExp [, $bForwardSearch = True [, $sDateTime = "" [, $minutesOffset = 0]]])
      Convert names in usable Cron expression values. e.g. "15-30 2,3,4,5 29 July-December Mo-Su" to "15-30 2,3,4,5 29 7-12 1-7"
      _pce_convertNames( $sCronExp )
      See the include for details.
       
      CronToTime_Test.au3
      CronToTime.au3
    • JNutt
      By JNutt
      I see $hWnd used as a local variable in a lot of script examples.  I know the 'h' is used for handles, but what is the 'Wnd' short for?
      Thanks!
    • 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
×