Last active
August 25, 2020 14:30
-
-
Save yehgdotnet/64021391edd0cbb0c25c7acf63ac7761 to your computer and use it in GitHub Desktop.
AutoIT Feed Reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Local $feed_file = "theregister.xml" | |
Local $hDownload = InetGet ( "http://www.theregister.co.uk/security/headlines.atom" , $feed_file ) | |
Local $file = FileOpen($feed_file, 0) | |
Global $security_feeds = "" | |
Global $counter = 0 | |
; Check if file opened for reading OK | |
If $file = -1 Then | |
MsgBox(0, "Error", "Unable to open file.") | |
Exit | |
EndIf | |
; Read in lines of text until the EOF is reached | |
While 1 | |
Local $line = FileReadLine($file) | |
local $nOffset = 1 | |
If @error = -1 Then ExitLoop | |
; find link | |
Local $found_link = StringInStr($line, '<link rel="alternate" type="text/html" href="') | |
If $found_link > 0 Then | |
Local $lnks = StringRegExp($line, '<link rel="alternate" type="text/html" href="(.*?)"/>', 1, $nOffset) | |
If UBound($lnks) > 0 Then | |
Local $lnk = $lnks[0] | |
$security_feeds = $security_feeds & '<a href="' & $lnk & '">' | |
Endif | |
EndIf | |
; find title | |
Local $found_title = StringInStr($line, '<title type="html">') | |
If $found_title > 0 Then | |
Local $titles = StringRegExp($line, '<title type="html">(.*?)</title>', 1, $nOffset) | |
if UBound($titles) > 0 then | |
Local $til = $titles[0] | |
$security_feeds = $security_feeds & $til & '</a><br>' & @CRLF | |
endif | |
$counter = $counter + 1 | |
If $counter > 7 Then | |
ExitLoop | |
EndIf | |
EndIf | |
WEnd | |
FileClose($file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment