umairrajan

writing a Webpage to a Txt file

5 posts in this topic

#1 ·  Posted (edited)

Hi,

i am trying to read a body of an internal webpage and write its body to a txt file after performaing a search. so far i have been able to figure out how to do that but the probleum is when ever the body is written in the txt file it is from the page prrior to the search. this is the code. 

#include <IE.au3>
 
Local $oIE = _IECreate("internal address")
_IELoadWait ($oIE)
Send("{T}{E}{S}{T}{SPACE}{A}{S}{S}{I}{G}{H}{N}{ENTER}")
_IELoadWait ($oIE)
$sText = _IEBodyReadText($oIE)
$file = FileOpen("test.txt", 1)
FileWrite($file, $sText)
 
one more detail when the search is performed the URL doesnot change. 
Edited by umairrajan

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It’s hard to say what is going on without seeing the webpage. There is a good chance IELoadWait ($oIE) is not actually waiting for the page to load after the send command. Try Sleep(10000) after the send command and see what happens.

Edited by Herb191

Share this post


Link to post
Share on other sites

_IECreate() does _IELoadWait() internally inside the function. Just a comment. :)


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Hi,

tested, 3 different webpages | each time the text file was updated withe new page | working fine here.

Maybe something on your end.

+>19:39:23 Starting AutoIt3Wrapper v.2.1.4.0 SciTE v.3.3.7.0 ;  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86    Environment(Language:0407  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86)

Share this post


Link to post
Share on other sites

It’s hard to say what is going on without seeing the webpage. There is a good chance IELoadWait ($oIE) is not actually waiting for the page to load after the send command. Try Sleep(10000) after the send command and see what happens.

thanks. This solved it 

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