bastian33 Posted May 22, 2017 Share Posted May 22, 2017 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! Link to comment Share on other sites More sharing options...
ATR Posted May 22, 2017 Share Posted May 22, 2017 $sText = _IEBodyReadText($oIE) ; or this? --> $sText = _IEPropertyGet("innerText") Do Sleep(1000) Until StringInStr($sText, 'Your text') Link to comment Share on other sites More sharing options...
Floops Posted May 22, 2017 Share Posted May 22, 2017 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') ATR 1 Link to comment Share on other sites More sharing options...
bastian33 Posted May 22, 2017 Author Share Posted May 22, 2017 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! Link to comment Share on other sites More sharing options...
bastian33 Posted May 22, 2017 Author Share Posted May 22, 2017 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! Link to comment Share on other sites More sharing options...
232showtime Posted May 22, 2017 Share Posted May 22, 2017 (edited) remove sleep... Edited May 22, 2017 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Danyfirex Posted May 22, 2017 Share Posted May 22, 2017 Don't Remove Sleep. Maybe Reduce it. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
bastian33 Posted May 23, 2017 Author Share Posted May 23, 2017 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! Link to comment Share on other sites More sharing options...
232showtime Posted May 23, 2017 Share Posted May 23, 2017 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 ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
bastian33 Posted May 24, 2017 Author Share Posted May 24, 2017 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! Link to comment Share on other sites More sharing options...
232showtime Posted May 24, 2017 Share Posted May 24, 2017 (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??? Edited May 24, 2017 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Floops Posted May 24, 2017 Share Posted May 24, 2017 How about this? _IELoadWait($oIE) $sText = _IEBodyReadText($oIE) If StringInStr($sText, "Comment submitted") Then Sleep(1000) EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now