Ticker: An RSS Scroller

Post your working scripts, libraries and tools
User avatar
Nextron
Posts: 1210
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Ticker: An RSS Scroller

03 Apr 2014, 17:48

I actually already patched that function in my personal copy for a fixed keyword to exclude advertisements. So it shouldn't be much effort to include a user setting for it. I'll probably will not get to that before tomorrow evening.

I'm also thinking about making some settings feed specific, such as:
  • number of items shown (higher number for frequently updated feeds)
  • fading colors (for example, blue background for national news, green for international, gray for tech
I've also been thinking about the following features, but I'm still thinking if and how I'll implement them.
  • date filter (for really slow feeds, drop items more than x days old)
  • description mouse over (some more info about the item before you click it, but this may be too obtrusive)
  • highlight updates (items added since previous RSS update display in a different text color) <- this would take some code overhauling
  • multiple rows of feeds (tried this, but it made every line very jerky)
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

03 Apr 2014, 18:47

i have come up with adding the following [IfNotInString] lines after line [RegExMatch(item,"iUs)<link.*>(.*)</link>",link)] and it seems to be working (?), but can this be improved?:

...
startpos:=pos+StrLen(item)
item:=RegExReplace(item,"iUs)<!\[CDATA\[(.+)\]\]>","$1")
RegExMatch(item,"iUs)<title.*>(.*)</title>",title)
RegExMatch(item,"iUs)<description.*>(.*)</description>",description)
RegExMatch(item,"iUs)<link.*>(.*)</link>",link)


IfNotInString, title1, keyword1
IfNotInString, title1, keyword2
IfNotInString, title1, keyword3
...

TickerItem.Insert([UnHTM(title1),UnHTM(description1),link1])
If (items>=TickerRssMaxItemsPerFeed)
Break
items++
...
Last edited by Guest10 on 06 Apr 2014, 06:08, edited 4 times in total.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

03 Apr 2014, 18:51

doh!! we seemed to have posted within 1 minute of each other (daylight saving time)? or 1 hh and 1 mm?
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

03 Apr 2014, 20:28

digging into my archives i came up with this:

...
startpos:=pos+StrLen(item)
item:=RegExReplace(item,"iUs)<!\[CDATA\[(.+)\]\]>","$1")
RegExMatch(item,"iUs)<title.*>(.*)</title>",title)
RegExMatch(item,"iUs)<description.*>(.*)</description>",description)
RegExMatch(item,"iUs)<link.*>(.*)</link>",link)


var := "keyword1|keyword2|keyword3|keyword4|keyword5"
If !(title1 ~= "i)" var) ; If NOT (title1 ~= "i)" var)


TickerItem.Insert([UnHTM(title1),UnHTM(description1),link1])
If (items>=TickerRssMaxItemsPerFeed)
Break
items++
...
Last edited by Guest10 on 06 Apr 2014, 06:04, edited 1 time in total.
roberti9
Posts: 3
Joined: 30 Mar 2014, 08:22

Re: Ticker: An RSS Scroller

04 Apr 2014, 03:37

It would be nice if you could add/choose/pick feeds using say Right Mouse button, or via a ini file/list. I'm new to RSS feeds and am battling getting ones to work I've found on the net. Anyone got a list of useful ones we could use?
User avatar
joedf
Posts: 6440
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Ticker: An RSS Scroller

06 Apr 2014, 02:29

Excellent idea! nice script :D

@tomoe_uehara hahahah true :D
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: Ticker: An RSS Scroller

06 Apr 2014, 02:39

:o :o :o :o :o
WOW!!
:mrgreen: :mrgreen: :mrgreen: :mrgreen:
John ... you working ?
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

06 Apr 2014, 14:48

i have an additional request/suggestion. is it possible to add some code to this script so that it periodically generates a report of all the headlines in a text file to read separately from the ticker and updates it periodically (let's say, every 15 minutes)? :geek:
User avatar
Nextron
Posts: 1210
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Ticker: An RSS Scroller

06 Apr 2014, 19:57

I've updated the script in the first post to include a blocklist for words in the title and an age filter for articles during the RSS update.

The blocklist is implemented almost the same as Guest10 has done, with a small difference that a discarded item doesn't consume one of the %TickerRssMaxItemsPerFeed% spots.
Implementing the age filter took more time than I thought because the publishing date format in RSS feeds is based on RFC822, which is 32 years old and wasn't really developed with parsability in mind. But luckily now it's done I don't have to look at the same news article for 3 days.
I've also made some other small changes to make the scripts cooperate better when included in another script. So to update it's best to copy-paste everything after the user settings. After that you need to add these two lines to the user settings:

Code: [Select all] [Download] GeSHi © Codebox Plus

TickerRssMaxAgeHours=18					;Maximum age in hours of each item in RSS feed before it's discarded during RSS update, ex: 18. 
TickerRssBlockedWords=Advertisement:|^ADV:|Happy zombies ;RSS titles containing any of these case-insensitive words are discarded, separate words using a pipe symbol (|). Actually this is a single regular expression, so more elaborate filtering is possible, hoever, because of this the characters: \.*?+[{|()^$ must be preceded by a backslash to be seen as literal



Guest10 wrote:i have an additional request/suggestion. is it possible to add some code to this script so that it periodically generates a report of all the headlines in a text file to read separately from the ticker and updates it periodically (let's say, every 15 minutes)? :geek:

Find the line

Code: [Select all] [Download] GeSHi © Codebox Plus

TickerItem.Insert([UnHTM(title1),UnHTM(description1),link1])

and add the following below (and edit the first line):

Code: [Select all] [Download] GeSHi © Codebox Plus

			NewsFile:=A_ScriptDir "\TickerNews.html" ;htm or html extenstions produce clickable links, other extensions produces plain text
If !NewsFileDeleted{
FileDelete, % NewsFile
NewsFileDeleted=1
}
If RegExMatch(NewsFile,"i)\.(htm|html)$")
FileAppend, % "<a href=""" link1 """>" UnHTM(title1) "</a><br>`n", % NewsFile
Else
FileAppend, % UnHTM(title1) "`t`t`t`t`t`t`t`t" link1 "`n", % NewsFile

The file will be updated during every RSS update.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

06 Apr 2014, 20:24

totally deck! :lol: thanks, i'll test. :ugeek:
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

06 Apr 2014, 22:15

deck! :lol: combined with "Reload Every" add-on for Firefox (which updates an open TickerNews.html tab every 15 minutes) this is a compete soup-2-nuts RSS fully-customized (with a keyword-based filter and the whole nine yards) LIVE news suite/package! thanks! :D
User avatar
joedf
Posts: 6440
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 09:56

is it "clickable"? i tried MButton, LButton, RButton... and nothing..
User avatar
Nextron
Posts: 1210
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Ticker: An RSS Scroller

08 Apr 2014, 10:11

It should be, with MButton as default. I just ran the copy from the start post and it seems to work. Did you add any custom feeds? If those don't supply a link or the link isn't parsed properly, there would be no target and clicking would result in nothing happening.
User avatar
joedf
Posts: 6440
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 10:55

Oh, oops! just redownloaded it. it works. Also, have you tried use the link control?
and, have tried reducing the flashing (under XP) ?
User avatar
Nextron
Posts: 1210
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Ticker: An RSS Scroller

08 Apr 2014, 12:10

I did try the link control. I don't exactly remember why I reverted to the text control. I think it was because the link got underlined which I didn't like and also I wanted to the link to trigger on only one specific mouse button. It could also be it didn't combine well with the clickthrough gui.

I haven't tried it on XP (EOL you know ;)) nor do I have an XP computer available for testing, but I wouldn't know how to improve any flashing other than increasing the timer. Under W7 I tried the Windows AnimateWindow function, but was slightly disappointed by its performance. Manually scripting a control to move looked equally smooth but offered increased control of the animation. It seems these controls aren't designed with animation in mind, as can be seen by the flashing or other strange effect mentioned by tomoe_uehara.
User avatar
joedf
Posts: 6440
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 15:01

oh, try this :
SetWinDelay,0 and SetBatchLines -1
User avatar
Nextron
Posts: 1210
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Ticker: An RSS Scroller

08 Apr 2014, 18:43

I think WinDelay has no effect here, since no window operations are performed. SetControlDelay was already in the script and I've added SetBatchLines.


I've updated the first post to include RSS specific background colors and also improved the HTML output to include the same coloring scheme (Guest10 8-), look for the TickerHtmlOutput-setting).

Image

I intended to produce a slow gradual color fade for the ticker but that resulted in crazy flickering, probably similar to what joedf experienced under XP. So now the default is a 300ms fade, starting when the last item of the leading feed exits the screen. This means that when there are many news items visible the coloring isn't foolproof.

Below is a 'backup' of the previous version 1.05.

Code: [Select all] [Expand] [Download] (Ticker_OLD_105.ahk)GeSHi © Codebox Plus

Last edited by Nextron on 08 Apr 2014, 18:58, edited 1 time in total.
User avatar
joedf
Posts: 6440
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 18:49

well, i just tried both under Win7... no flickering, well.. anyways, no worries.. XP Support is ending today :P
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

08 Apr 2014, 23:01

thanks for the update! tested on XP only. all features work as laid out above. color design grabs attention as colors change in the ticker. coloring scheme for TickerHtmlOutput and its setting are also innovative. these are initial results but will test some more! :ugeek:
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Ticker: An RSS Scroller

15 Apr 2014, 13:54

i wonder if this script can be further modified so that i can get variable number of items (headlines) per each feed location. for example, 5 items (headlines) from feed location 1; 3 headlines from feed location 2; 1 headline from feed location 3; etc.? currently, i can get only a fixed number of items for all feed locations.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 25 guests