Jump to content

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


MAS
 Share

Recommended Posts

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

Link to comment
Share on other sites

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")

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...