pintas Posted April 3, 2019 Posted April 3, 2019 (edited) Hi. I'm trying to get text from a website and later save it to a txt file. When i use a specific url it doesn't work. It gets nothing. So, if i use this code, it works: #include <IE.au3> $MainForm = GUICreate("hidden",0,0,0,0) $oIE = _IECreateEmbedded() ; embedded ie window GUICtrlCreateObj($oIE, 99999, 99999, 0, 0) GUISetState(@SW_HIDE) $mUrl = "www.citronresearch.com" _dostuff() while 1 Sleep(100) WEnd func _dostuff() _IENavigate($oIE, $mUrl) Local $sText = _IEBodyReadText($oIE) ConsoleWrite($sText) MsgBox($MB_SYSTEMMODAL, "Body Text", $sText) Exit EndFunc But if i use this specific url, it doesn't.: #include <IE.au3> $MainForm = GUICreate("hidden",0,0,0,0) $oIE = _IECreateEmbedded() ; embedded ie window GUICtrlCreateObj($oIE, 99999, 99999, 0, 0) GUISetState(@SW_HIDE) $mUrl = "http://www.planalto.gov.br/ccivil_03/_Ato2015-2018/2018/Lei/L13709.htm" _dostuff() while 1 Sleep(100) WEnd func _dostuff() _IENavigate($oIE, $mUrl) Local $sText = _IEBodyReadText($oIE) ConsoleWrite($sText) MsgBox($MB_SYSTEMMODAL, "Body Text", $sText) Exit EndFunc Any idea how to get the text from this specific url? i also can't get the source from that url using InetGetSource. I get this error: <noscript>Please enable JavaScript to view the page content.<br/>Your support ID is: 3084623253408755162.</noscript> Edited April 4, 2019 by pintas
Nine Posted April 3, 2019 Posted April 3, 2019 (edited) You need to wait for the page to load. Either put 1 as 3rd parameter of IENavigate or use _IELoadWait... By default, Navigate waits. So I tested your script and it works for me. Edited April 3, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
pintas Posted April 3, 2019 Author Posted April 3, 2019 1 hour ago, Nine said: You need to wait for the page to load. Either put 1 as 3rd parameter of IENavigate or use _IELoadWait... Thanks @Nine I tried that, but it didn't work. I still get a blank message box.
Nine Posted April 3, 2019 Posted April 3, 2019 Strange, like I said, I use your code without a change and it is working fine for me. Maybe try to unhide the IE to see what's going on. pintas 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
Earthshine Posted April 3, 2019 Posted April 3, 2019 (edited) works for me too. I tested the top version of code too, it works without ie being opened and returns the body text of that page Edited April 3, 2019 by Earthshine pintas 1 My resources are limited. You must ask the right questions
pintas Posted April 4, 2019 Author Posted April 4, 2019 (edited) Ok, i think i have a browser that's somehow hijacking the script. I'll make some more tests. Thanks guys! Edit: Ok, got it to work. My browser was trying to steal the focus from IE. Thank you so much guys! Edited April 4, 2019 by pintas Got it working!
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