Jump to content

Program Request


Recommended Posts

Hello everyone, I am wondering can someone make a small program for me that reads an RSS feed and displays the title of it in a small window?

(The window size should be about like this size:

|------------------------------------------------------------- |

|--------------------------------------------------------------|

|latest-rss-topic-in-this-box-the-program-name-in |

|box-above-which-I-can-edit-via-script-thanks-all! |

|--------------------------------------------------------------|

)

Also if you could make it so it plays the Windows notify sound when a new post is added?

Thanks so much! I would like this script if anyone could help to make an RSS reader app

for my wordpress blog.

-Dalton

Edited by Dalton F.
Link to comment
Share on other sites

1

we can help for free... if you try, we help

2

You can make a small Donation to Autoit.. post that recipt here and i am sure someone ( including me ) will help make it for you

3

What a mess.

So which one do I use?

That's 7 -- count 'em, 7! -- different formats, all called "RSS".

4

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

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I'll try(since I'm stuck on my other project), but could you be more specific about what you want?

EDIT: This is trickier than I figured, many RSS feeds use something that inetgetsize won't read. So, the problem is how do you want it updated? If the file size is 0 on the server, we'd have to download the file once again, even if there are no changes. This would be a large waste of resources, so if anyone has any advice that'd be great.

Edited by MikelSevrel

Coming soon....

Link to comment
Share on other sites

Thanks everyone, ok-here's what I want:

A program, about the size of an alert window that runs in the background and every [time I can edit in script] downloads a feed from my WordPress blog and displays the post title in the box, and the title I can edit in the script. No traybar icon, if possible I don't really want a button in the taskbar, no ok,yes,no buttons but you can close it by clicking X and closing it. Thanks for anyone who helps!

Link to comment
Share on other sites

I don't think I understand what you want, but here is this.

:::NOTE:::

Do NOT Run, because this will constantly download your feed. I'm tired, right now, and I can't think of a way to do download every so often without the exit button being inaccessible.

#include <GUIConstants.au3>
#include <File.au3>
#include <Array.au3>

; == GUI generated with Koda ==

_retreive()
Func _retreive()
InetGet("http://dtfnet.com/press/?feed=rss2","tmp.xml")
_makeheadlines()
EndFunc

Func _makeheadlines()
$lines = _FileCountLines("tmp.xml")
For $i = 1 To $lines
    $fileline = FileReadLine("tmp.xml",$i)
    If StringInStr($fileline,"<item>") Then
        $headline = StringTrimRight(StringTrimLeft(FileReadLine("tmp.xml",$i + 1),9),8)
        ExitLoop
    EndIf
Next
FileWriteLine("tmp.txt",$headline)
$rss = GUICreate("RSS", 325, 56, 192, 125)
GUICtrlCreateLabel($headline, 16, 8, 195, 41)
GUISetState(@SW_SHOW)
EndFunc

Func _retreive2()
InetGet("http://dtfnet.com/press/?feed=rss2","tmp2.xml")
$size1 = FileGetSize("tmp.xml")
$size2 = FileGetSize("tmp2.xml")
If $size1 = $size2 Then
Else
    FileMove("tmp2.xml","tmp.xml")
    SoundPlay("Some wav or mp3 here")
    _makeheadlines()
EndIf
EndFunc
While 1
    _retreive2()
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Coming soon....

Link to comment
Share on other sites

  • Moderators

Yeah, sorry I can't help more right now. My brain is imploding. Plus, I barely know anything about AutoIt. :o

I commend you.. You Read the help file >> Demonstrated Intuiteness >> Put forth an effort.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

^Thank you. I've never done anything like this before, but AutoIt seems to be pretty well documented.

Anyhow, looks like AdlibEnable will get us out of this mess.

#include <GUIConstants.au3>
#include <File.au3>
#NoTrayIcon

_retreive()
Func _retreive()
InetGet("http://dtfnet.com/press/?feed=rss2","tmp.xml")
_makeheadlines()
EndFunc

Func _makeheadlines()
$lines = _FileCountLines("DIR OF YOUR CHOICE\tmp.xml")
For $i = 1 To $lines
    $fileline = FileReadLine("tmp.xml",$i)
    If StringInStr($fileline,"<item>") Then
        $headline = StringTrimRight(StringTrimLeft(FileReadLine("tmp.xml",$i + 1),9),8)
        ExitLoop
    EndIf
Next
FileWriteLine("DIR OF YOUR CHOICE\tmp.txt",$headline)
$rss = GUICreate("RSS", 296, 94, 199, 126)
GUICtrlCreateLabel($headline,8, 8, 280, 68)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
EndFunc

Func _retreive2()
    FileDelete("tmp2.xml")
InetGet("http://dtfnet.com/press/?feed=rss2","tmp2.xml")
$size1 = FileGetSize("DIR OF YOUR CHOICE\tmp.xml")
$size2 = FileGetSize("DIR OF YOUR CHOICE\tmp2.xml")
If $size1 = $size2 Then
Else
    FileMove("DIR OF YOUR CHOICE\tmp2.xml","DIR OF YOUR CHOICE\tmp.xml")
    SoundPlay("Some wav or mp3 here")
    _makeheadlines()
EndIf
EndFunc
While 1 
    AdlibEnable("_retreive2",1200000)
    $msg = GuiGetMsg()
    Select
        
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit
It's currently set to update every 20 minutes. I think I got it this time, if I didn't, sorry. Also, if anyone could provide any input on the thread in my sig that'd be great.

EDIT: Forgot you didn't want a tray icon.

Edited by MikelSevrel

Coming soon....

Link to comment
Share on other sites

  • Moderators

@MikeSevrel - Since you did try very hard, thought I would take a stab at it a bit... Look over the code... It's useless really to someone that the RSS feed information would be different (intentional), because if you study the code you'll know where to edit to fix the issue of a different feed. I went off your example

#include <GUICONSTANTS.AU3>
#include <File.au3>
#NoTrayIcon
Opt('OnExitFunc', 'EXITSCRIPT')
HotKeySet('{ESC}', 'EXITSCRIPT'); USE THE ESC BUTTON ON YOUR KEY BOARD TO EXIT THE SCRIPT
Global $RSS_URL = ''
Global $XML_DIRECTORY = FileSelectFolder('Select the folder to put the XML files in', @HomeDrive);@ScriptDir
$MAIN_GUI = GUICreate('RSS Feeds', 600, 400)
$BUTTON = GUICtrlCreateButton('Start Feed', 10, 10, 80, 30)
$INPUT = GUICtrlCreateInput('http://dtfnet.com/press/?feed=rss2', 100, 15, 450, 20)
$EDIT1 = GUICtrlCreateEdit('', 10, 50, 580, 340, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $WS_VSCROLL, $WS_HSCROLL))

GUISetState()

Local $TIMER = ''
Local $StartTimer = 0

While 1
    $rss_msg = GUIGetMsg()
    Select
        Case $rss_msg = $GUI_EVENT_CLOSE
            EXITSCRIPT()
        Case $rss_msg = $BUTTON
            $RSS_URL = GUICtrlRead($INPUT)
            If $INPUT <> '' And StringInStr($RSS_URL, 'http:') Then
                InetGet($RSS_URL, $XML_DIRECTORY & "\tmp.xml")
                $fzPath = $XML_DIRECTORY & '\tmp.xml'
                $DataRetrieve = GetRSSFeed($fzPath)
                GUICtrlSetData($EDIT1, $DataRetrieve)
                $TIMER = TimerInit()
                $StartTimer = 1
            Else
                MsgBox(64, 'Error', 'You need to provide the RSS url or you are missing the http:')
            EndIf
        Case TimerDiff($TIMER) / 1000 >= 10 And $StartTimer = 1; CHECK EVERY 1 MINUTE, CHANGE 60 (IN SECONDS) IF YOU NEED IT LONGER OR SHORTER
            RSS_RETRIEVE()
            $fzPath = $XML_DIRECTORY & '\tmp2.xml'
            $DataRetrieve = GetRSSFeed($fzPath)
            If GUICtrlRead($EDIT1) <> $DataRetrieve Then GUICtrlSetData($EDIT1, $DataRetrieve)
            $TIMER = TimerInit(); RESET THE TIMER
    EndSelect
    Sleep(10)
WEnd

Func RSS_RETRIEVE()
    InetGet($RSS_URL, $XML_DIRECTORY & '\tmp2.xml')
    Local $fz_FileOpen1 = FileOpen($XML_DIRECTORY & '\tmp.xml', 0)
    Local $fz_FileOpen2 = FileOpen($XML_DIRECTORY & '\tmp2.xml', 0)
    Local $fz_FileRead1 = FileRead($XML_DIRECTORY & '\tmp.xml', _FileCountLines($XML_DIRECTORY & '\tmp.xml'))
    Local $fz_FileRead2 = FileRead($XML_DIRECTORY & '\tmp2.xml', _FileCountLines($XML_DIRECTORY & '\tmp2.xml'))
    If $fz_FileRead1 <> $fz_FileRead2 Then
        FileMove($XML_DIRECTORY & '\tmp2.xml', $XML_DIRECTORY & '\tmp.xml')
    ;SoundPlay("Some wav or mp3 here")
        If FileExists($XML_DIRECTORY & '\tmp2.xml') Then
            Do
                FileDelete($XML_DIRECTORY & '\tmp2.xml')
            Until Not FileExists($XML_DIRECTORY & '\tmp2.xml')
        EndIf
    EndIf
    FileClose($fz_FileOpen1)
    FileClose($fz_FileOpen2)
EndFunc  ;==>RSS_RETRIEVE

Func EXITSCRIPT()
    If FileExists($XML_DIRECTORY & '\tmp.xml') Then
        Do
            FileDelete($XML_DIRECTORY & '\tmp.xml')
        Until Not FileExists($XML_DIRECTORY & '\tmp.xml')
    EndIf
    If FileExists($XML_DIRECTORY & '\tmp2.xml') Then
        Do
            FileDelete($XML_DIRECTORY & '\tmp2.xml')
        Until Not FileExists($XML_DIRECTORY & '\tmp2.xml')
    EndIf
    Exit
EndFunc  ;==>EXITSCRIPT


Func GetRSSFeed($fzPath)
    Local $nArray = ''
    Local $ReturnRSS = ''
    Local $Show_Date_Time = ''
    Local $fzFileRead = _FileReadToArray($fzPath, $nArray)
    For $i = 1 To UBound($nArray) - 1
        $rss_Date = StringRegExp($nArray[$i], '(<pubDate>)([^</]*)', 1)
        If @error = 0 And @extended Then
            If StringInStr($rss_Date[1], ' +0000') Then
                $Show_Date_Time = StringReplace($rss_Date[1], ' +0000', "")
            Else
                $Show_Date_Time = $rss_Date[1]
            EndIf
        EndIf
        $rss_Feed = StringRegExp($nArray[$i],'(<p>)([^</]*)', 1)
        If @error = 0 And @extended Then
            If StringInStr($rss_Feed[1], '’') Then
                $rss_Feed = StringReplace($rss_Feed[1], '’', "'")
                $ReturnRSS = $ReturnRSS & $Show_Date_Time & @CRLF & $rss_Feed & @CRLF & @CRLF
            Else
                $ReturnRSS = $ReturnRSS & $Show_Date_Time & @CRLF & $rss_Feed & @CRLF & @CRLF
            EndIf
        EndIf
    Next
    Return $ReturnRSS
EndFunc

Edit:

Had timer set to 10 for testing, it's reset to 60 representing 60 seconds.

Edit2:

Had a variable backwards.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Got an error-

Line 21

FileWriteLine("C:\tmp.txt",$headline)

FileWriteLine("C:\tmp.txt,^ERROR

Error: Variable used without being declared

I don't even have that in the example I gave.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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