Jump to content

Why does this not work?


Recommended Posts

It's late, and I may be getting a little dense, but why do I get:

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

with the following: (forget about the actual code and whether it will work or not. I'm wondering why I get the "no matching If statement")

#include <GUIConstants.au3>
#include <IE.au3>

$Count=1
If @error Then $Count = 2
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd
EndIf

and the same message with:

#include <GUIConstants.au3>
#include <IE.au3>

If @error Then $Count = 2
Endif
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd

This, of course, is while attempting to "Beta Run"

Link to comment
Share on other sites

  • Moderators

It's late, and I may be getting a little dense, but why do I get:

with the following: (forget about the actual code and whether it will work or not. I'm wondering why I get the "no matching If statement")

#include <GUIConstants.au3>
#include <IE.au3>

$Count=1
If @error Then $Count = 2
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd
EndIf

and the same message with:

#include <GUIConstants.au3>
#include <IE.au3>

If @error Then $Count = 2
Endif
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd

This, of course, is while attempting to "Beta Run"

#include <GUIConstants.au3>
#include <IE.au3>

$Count=1
If @error Then 
   $Count = 2
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd
EndIf

Or

#include <GUIConstants.au3>
#include <IE.au3>

$Count=1
If @error Then $Count = 2
   While $Count = 1
     $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0)
     $oCust1.checked = True
     $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1)
     $oCust2.checked = True
     $count=2
  WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If you look at If...Then in the help file you will see that

If @error Then $Count = 2

does not need an EndIf

but

If @error Then
$Count = 2

does.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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...