Jump to content

RTE Headline Reader


Lmac34
 Share

Recommended Posts

hi guys

long time read

First time submission,

Got bored in work today so i decided to look around the forms

found two programs of interest,

http://www.autoitscript.com/forum/index.php?showtopic=12748

and

some example from the IE.au3

http://www.autoitscript.com/forum/index.php?showtopic=13398 Designer "Dale"

and thought that they would be very useful if they where but together.

so here it is.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Designer: Luke Mc Redmond

;; Date: 05/12/2005

;; Version: 1

;; Description: To Read The Headlines form the RTE Web Site

;; Acknowledgements: Dale "Internet Explorer Automation UDF library" and Unknown "speaks text to you"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#include <GUIConstants.au3>

#include <IE.au3>

$oIE = _IECreate()

_IENavigate($oIE, "http://www.rte.ie/news/")

$body = _IEBodyReadHTML($oIE)

Dim $file = FileOpen("HtmlBody.txt",2)

FileWrite($file,$body)

FileClose($file)

Dim $file = FileOpen("HtmlBody.txt",0)

dim $file2 = FileOpen("htmlParsedTxt.txt",2)

local $line

;gets main body text removes all http tags <***************************>

While 1

local $line = FileReadLine($file)

If @error = -1 Then ExitLoop

FileWriteLine($file2,StringRegExpReplace($line, "<(.|\n)+?>", @CRLF))

WEnd

FileClose($file2)

FileClose($file)

; NOW GOING TO OPEN THE PARSEDTXT FILE AND DELETE DOWN TO THE CONTACT US

DIM $file3 = FileOpen("ReadFile.txt",2)

$file2 = FileOpen("htmlParsedTxt.txt",0)

local $foundContact = 0

While 1

local $line = FileReadLine($file2)

If @error = -1 Then ExitLoop

If (StringInStr($line,"Contact us ")) Then

$foundContact = 1

EndIf

If (StringInStr($line,"Sports News")) Then

$foundContact = 0

EndIf

if ($foundContact == 1) Then

if($line <> "") Then

if(StringInStr($line," ")) Then

$line = StringReplace($line," "," ")

EndIf

FileWriteLine($file3,$line)

EndIf

EndIf

WEnd

FileClose($file2)

FileClose($file3)

$file3 = FileOpen("ReadFile.txt",0)

local $index = 0

While 1

local $line = FileReadLine($file3)

If @error = -1 Then ExitLoop

if ($index > 3) Then

_TalkOBJ($line, 3)

EndIf

$index = $index + 1

WEnd

FileClose($file3)

FileDelete("HtmlBody.txt");

FileDelete("htmlParsedTxt.txt")

FileDelete("ReadFile.txt")

_TalkOBJ("That was the Headlines for Today", 3)

_TalkOBJ("This Program was Brought to you by Luke Mc Redmond", 3)

_TalkOBJ("Hope You Enjoyed It Good Bye", 3)

Func _TalkOBJ($s_text, $s_voice = 3)

Local $o_speech = ObjCreate ("SAPI.SpVoice")

Select

Case $s_voice == 3

$o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)

EndSelect

$o_speech.Speak ($s_text)

$o_speech = ""

EndFunc ;==>_TalkOBJ

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Just thought it might be useful for some one,

Please feel free to modify, change, improve etc....

TakeCare GentlePeople

LMAC34

RTE_Headlines_Reader.au3

Link to comment
Share on other sites

Maybe edit your post with this

[ code ] ; no spaces

; paste your code here

[ /code]

Looks like this

; paste your code here

BTW.... Great first post

8)

Thank you for sharing that with me, I always wanted to know how that was done.

I didnt see any option on the submit page.

Cheers!

Hope to hear for you again some time soon.

LMAC

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...