bastian33

Wait until text is visible

12 posts in this topic

#1 ·  Posted

Hey all,

 

I'm trying to build a simple comment poster, but I'm stuck at this; I'd like for script to wait until a text "Comment submitted" is visible on page, then sleep.

Here is my poor code for this func so far:

$sText = _IEBodyReadText($oIE) ; or this? --> $sText = _IEPropertyGet("innerText")
    If $sText="The text you're looking for" Then
        sleep(1000)
    EndIf

Help, pls:)

Thanks!

Share this post


Link to post
Share on other sites



#3 ·  Posted

Wouldn't you have to put the _IEBodyReadText() into the loop aswell? Like this?

 

Do
    Sleep(1000)
    $sText = _IEBodyReadText($oIE) ; or this? --> $sText = _IEPropertyGet("innerText")
Until StringInStr($sText, 'Your text')

 

1 person likes this

Share this post


Link to post
Share on other sites

#4 ·  Posted

Hey,

 

Thank you so much:)

I'll test it and let you know tomorrow.

Wow, I love this forum's responsiveness, lol.

 

Have a nice day!

Share this post


Link to post
Share on other sites

#5 ·  Posted

Sorry, just figured out that the script mustn't sleep, until text is visible, but Wait for the text.

So something similar to my code above, but working one:)

Any ideas?

 

Thanks!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

remove sleep...

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#7 ·  Posted

Don't Remove Sleep. Maybe Reduce it.

 

Saludos

Share this post


Link to post
Share on other sites

#8 ·  Posted

It would be better, if I could use the Wait function somehow, instead of Sleep. This one is bugging me, 'cause I don't know how to make it wait until the text is found, not sleep. Ugh...

Help, pls? Thanks!

Share this post


Link to post
Share on other sites

#9 ·  Posted

im not  familiar with IE func, did a quick look in the help file for IE, based from helpfile and script from above, I came up with this:

#include <IE.au3>
#include <MsgBoxConstants.au3>
Global $var = "user forum", $counter = 1
Global $oIE = _IE_Example("basic")
Sample()


Sleep(1000)

Global $var = "HTML"
Global $oIE = _IE_Example("basic")
Sample()

Func Sample()

    Do
        $sText = _IEBodyReadText($oIE) ; or this? --> $sText = _IEPropertyGet("innerText")
    Until StringInStr($sText, $var)

    _IEQuit($oIE)
    If $counter = 1 Then
        MsgBox($MB_OK, "", $counter & "st" & @CRLF & $var)
    Else
        MsgBox($MB_OK, "", $counter & "nd" & @CRLF & $var)
    EndIf

    $counter += 1
EndFunc   ;==>Sample

:sweating:


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#10 ·  Posted

232showtime, thanks but not working:)

It has to be a simple way to wait until the text is visible on page. Just wait for it, and when it's there, sleep 1000 then close.

Anyone? Thanks!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

weird, its working in my side, I changed the value in 1st $var so the script will wait for the text in 1st $var and run the script,  while the script is active I changed the value in IE Browser and 1st msgbox poped up...

 

how about showing some reproducer??? :lol:

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

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