Jump to content
Sign in to follow this  
MattX

What The F**

Recommended Posts

MattX

Can someone please explain why I am getting a:

Error: "EndIf" statement with no matching "If" statement

With this code:

; AutoIt Version:  3

; Language:        English

; Platform:        WinXP

; Author:          ************@*********

; Script Function:  Message Of The Day Program

$__msgbox = MsgBox(64, 'St Johns Network Message Of The Day', _

      'Test message for the St Johns Network Message Of The Day Program.' & @CRLF & _

      @CRLF & _

      'Matt ***** - IT Tech' & @CRLF & _

      @CRLF & _

      'Click on OK to close this box.') & @CRLF & _

      If ($__msgbox = 1) Then

Exit

Endif

My brain is gonna explode - I've already shouted at my computer as there is a IF statement in there.

Is It Obvious ? Am I stupid ?

If I take out the If and Endif then the message appears and when you click on the OK button you get a "Error In Expression" error ? Is that because there is no code for the return value ?

Edited by MattX

Share this post


Link to post
Share on other sites
Jon

Can someone please explain why I am getting a:

Error: "EndIf" statement with no matching "If" statement

With this code:

My brain is gonna explode - I've already shouted at my computer as there is a IF statement in there.

Is It Obvious ? Am I stupid ?

If I take out the If and Endif then the message appears and when you click on the OK button you get a "Error In Expression" error ? Is that because there is no code for the return value ?

You've got a line continutation character _ on the previous line to the IF statement so it gets merged with the line above - so AutoIt doesn't think there is an IF statement there then. :idiot:

Share this post


Link to post
Share on other sites
MattX

You've got a line continutation character _ on the previous line to the IF statement so it gets merged with the line above - so AutoIt doesn't think there is an IF statement there then. :idiot:

<{POST_SNAPBACK}>

You know what, I just noticed that on the script - took it out and it worked - thanks for the quick reply Jon - as usual there is a line up of drinks in bar in Birmingham if I ever get to meet you....

Share this post


Link to post
Share on other sites
herewasplato

try this:

$__msgbox = MsgBox(64, 'St Johns Network Message Of The Day', _
      'Test message for the St Johns Network Message Of The Day Program.' & @CRLF & _
      @CRLF & _
      'Matt ***** - IT Tech' & @CRLF & _
      @CRLF & _
      'Click on OK to close this box.')
If ($__msgbox = 1) Then
   Exit
EndIf

Jon beat me to the post...

Scite and Tidy might help you.........


[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×