Jump to content

Recommended Posts

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?

Link to comment
Share on other sites

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

×
×
  • Create New...