Jump to content

if then, elseif, else


Recommended Posts

<FONT color=#666666><IMG height=1 src="1pixclear.gif" width=4>Done </FONT>

#include <IE.au3>
#include <File.au3>
Opt("WinTextmatchMode", 1)
Opt("WinTitleMatchMode",3)

$title = _IETagNameGetCollection($oIE, "IMG")
for $ti in $title
    If ($ti.innerText) = "Doing" Then
        ConsoleWrite("Correct Values" & @CRLF)
        ElseIf ($ti.innerText) = "Done" Then
        ConsoleWrite("Incorrect Values" & @CRLF)
       Else
        ConsoleWrite("Wrong Model. See you again" & @CRLF)
    EndIf
next

Script runs fine but never goes through the Done path and instead executes the Doing path.

what am I doing wrong???

Edited by diikee
Link to comment
Share on other sites

I've not used _IETagNameGetCollection before, but I'll take a stab at it. I'm thinking your For loop should read as 'For $ti in $title.innerText' - and then you use $ti instead of $ti.innerText. My assumption is that $title returns only 1 object, and so the For loop only executes once. To test this, throw in a variable to count the number of loops executed and output that with your ConsoleWrite. Also, try forcing the first run to be "Done" instead of "Doing". That will at least narrow things down for you.

Link to comment
Share on other sites

<FONT color=#666666><IMG height=1 src="1pixclear.gif" width=4>Done </FONT>

#include <IE.au3>
#include <File.au3>
Opt("WinTextmatchMode", 1)
Opt("WinTitleMatchMode",3)

$title = _IETagNameGetCollection($oIE, "IMG")
for $ti in $title
    If ($ti.innerText) = "Doing" Then
        ConsoleWrite("Correct Values" & @CRLF)
        ElseIf ($ti.innerText) = "Done" Then
        ConsoleWrite("Incorrect Values" & @CRLF)
       Else
        ConsoleWrite("Wrong Model. See you again" & @CRLF)
    EndIf
next

Script runs fine but never goes through the Done path and instead executes the Doing path.

what am I doing wrong???

Can you post your full code please?

As far as I can see, you've done nothing wrong in that part of the code..

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