Jump to content
Sign in to follow this  
thistleback

New user - ElseIf syntax error

Recommended Posts

thistleback

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

Share this post


Link to post
Share on other sites
Jos

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
thistleback

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!

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
Sign in to follow this  

×