Jump to content
Sign in to follow this  
MAS

How write formatted text returned from "_IEBodyReadText" to txt file

Recommended Posts

MAS

hello all

I use _IEBodyReadText to get the source text of a webpage and then

put the source text into a text file by FileWrite

but the text will be in one line

I want the text file to be the same as the source html

thanks for any help

Share this post


Link to post
Share on other sites
iamtheky

Post your code, or at least the site you are having issues with. My test script with techdirts wall of text works fine.

#include <IE.au3>

$oIEtech = _IECreate("www.techdirt.com" , 0 , 1)

$sText = _IEBodyReadText($oIEtech)

FileWrite ("test.txt" , $sText)

run ("notepad " & @Scriptdir & "test.txt")

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
MAS

sorry i was using _INetGetSource with text files

thanks boththose

it works fine

#include <INet.au3>
$sText = _INetGetSource("http://www.catonmat.net/download/awk.cheat.sheet.txt")
FileWrite ("test.txt" , $sText)
run ("notepad " & @Scriptdir & "test.txt")

The problem with only text files with _INetGetSource

Edited by MAS

Share this post


Link to post
Share on other sites
iamtheky

Think it may be your editor of choice, moreso than the get. may need to adjust the path to wordpad, but this seems to keep the formatting just fine.

#include <INet.au3>

If fileexists (@ScriptDir & "test.txt") Then FileDelete(@ScriptDir & "test.txt")

$sText = _INetGetSource("http://information.co.nf/text.txt")
FileWrite ("test.txt" , $sText)
run ("C:Program FilesWindows NTAccessorieswordpad.exe " & '"' & @Scriptdir & 'test.txt' & '"') ;

Exit
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
MAS

Yes It's now works very well with txts

thanks very much boththose ;)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.