Sign in to follow this  
Followers 0
diikee

if then, elseif, else

3 posts in this topic

#1 ·  Posted (edited)

<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

Share this post


Link to post
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.

Share this post


Link to post
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..

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  
Followers 0