Jump to content

New user - ElseIf syntax error


Recommended Posts

Please excuse a new user for asking a simple question. I have a syntax error but cannot figure out why. The checker reported

"S:\_Branch 8\IT Department\Scripts\easyLENDER_Upgrade\2010-5_Update\Upgrade_easyACCESS-v7.05_Update_2.au3(32,1) : ERROR: syntax error

ElseIf

Here is the lines of code. Can someone tell me what the error is?

If WinWaitActive($WindowTitle, "Complete") Then ControlClick($WindowTitle, "", 503)

; Click on Finish button

ElseIf WinWaitActive($WindowTitle, "Maintenance Complete") Then ControlClick($WindowTitle, "", 4)

Else

EndIf

Link to comment
Share on other sites

  • Developers

You cannot have a one-line If...Then and also use ElseIf/Else

If WinWaitActive($WindowTitle, "Complete") Then
    ControlClick($WindowTitle, "", 503)

    ; Click on Finish button
ElseIf WinWaitActive($WindowTitle, "Maintenance Complete") Then
    ControlClick($WindowTitle, "", 4)

Else

EndIf

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

If you are going to use the single-line syntax for If/Then, you cannot also have Else/ElseIf/EndIf. Just put your conditional ControlClick() on the line after IF, and the conditional one after ElseIf on the line after that.

:idea:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You cannot have a one-line If...Then and also use ElseIf/Else

If WinWaitActive($WindowTitle, "Complete") Then
    ControlClick($WindowTitle, "", 503)

    ; Click on Finish button
ElseIf WinWaitActive($WindowTitle, "Maintenance Complete") Then
    ControlClick($WindowTitle, "", 4)

Else

EndIf

Thank you. The help file wasn't as much help as a real live person!
Link to comment
Share on other sites

  • Developers

Thank you. The help file wasn't as much help as a real live person!

Helpfile is pretty clear in showing the 2 options I would think. :idea:

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...