Ticker: An RSS Scroller

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 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: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Ticker: An RSS Scroller

06 Apr 2014, 02:29

Excellent idea! nice script :D

@tomoe_uehara hahahah true :D
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
smorgasbord
Posts: 493
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: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 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

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

TickerItem.Insert([UnHTM(title1),UnHTM(description1),link1])
and add the following below (and edit the first line):

Code: Select all

			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: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 09:56

is it "clickable"? i tried MButton, LButton, RButton... and nothing..
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 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: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
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) ?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 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: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Ticker: An RSS Scroller

08 Apr 2014, 15:01

oh, try this :
SetWinDelay,0 and SetBatchLines -1
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 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

;Ticker: An RSS Scroller 1.05 by NextronNL
;A smooth news ticker using RSS feeds of your choice.

;User settings below.

;When including this in your own script, please note:
;Use of globals is minimized. All globals start with Ticker*, to prevent conflicts.
;The label TickerAutorun needs to be run at least once.
;Label TickerGuiStart created the gui.
;Label TickerGuiClose destroys the gui and resets variables.
;Label TickerGuiToggle toggles between the two.

;The script contains three functions written by others that may conflict with the including script, and may need to be removed:
;GetTextSize by Laszlo
;UrlDownloadToVar by Eddy
;UnHTM by SKAN

;Known issues:
;Mouseover pause works by comparing the mouse location with the gui coordinates, not the actual gui window. So the ticker will pause even if it is covered by another window.

;User Settings
TickerAutorun:
#SingleInstance,Force                   ;Remove this entire line if it you include the Ticker script in your existing script and it poses a conflict.
TickerButton=MButton                    ;The Gui is clickthrough, except for this button which opens the link to the article.
TickerTopOfScreenInsteadOfBottom=0      ;0: Gui is placed at the bottom of the screen, above the taskbar. 1: Gui is placed at the top of the screen.
TickerTopMostInsteadOfBottom=0          ;0: Gui is placed at the lowest Z-order, below other windows. 1: Gui is always on top.
TickerShowDescription=0                 ;0: Scroll just the titles of the articles. 1: Scroll the titles and their descriptions.
TickerTransparancy=180                  ;Gui transparancy 0-255 (Fully transparant - Opaque).
TickerBackgroundColor=0077FF            ;Gui background color. RGB-hex, ex: 0077FF or name, ex: red.
TickerTextColor=F0F0F0                  ;Text color. RGB-hex, ex: F0F0F0 or name, ex: blue.
TickerTextSize=16                       ;Text size. Point number, ex: 16.
TickerTextWeight=Bold                   ;Text weight. Number 1-1000 (400 is normal and 700 is bold). The following words are also supported: bold, italic, strike, underline, and norm.
TickerTextFont=                         ;Text font. Name, ex: Verdana. Or empty for default.
TickerSeperation=70                     ;Distance between individual items. Number in pixels, ex: 70.
TickerScrollSpeed=1.8                   ;Scrolling speed. Number of pixels per time interval, ex: 1.4
TickerMessageQueue=7                    ;Maximum number of items that can be visible at once. Required number depends on item length, text size, screen width and seperation. A number to low cause items tp blink in view. High number requires more resources.
TickerPauseOnMouseover=1                ;0: Items always scroll. 1: Scrolling is paused when the mouse is hovering over them.
TickerTimer=10                          ;Update interval of scrolling in milliseconds, ex: 10
TickerRssRefresh=15                     ;Update interval of RSS feed in minutes, ex: 15
TickerRssMaxItemsPerFeed=8              ;Maximum number of items to retrieve from each RSS feed, ex: 8.
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
TickerRss:=Array()                      ;Initialize RSS array, leave this.
TickerRss.Insert("http://rss.cnn.com/rss/edition.rss")      ;Url of RSS feed to use. Multiple feeds allowed. For each new RSS feed, use a new line, ex: TickerRss.Insert("http://rss.cnn.com/rss/edition.rss") .
TickerRss.Insert("http://feeds.bbci.co.uk/news/rss.xml")
TickerRss.Insert("http://hosted.ap.org/lineups/TOPHEADS.rss?SITE=AP&SECTION=HOME")
TickerRss.Insert("http://feeds.reuters.com/reuters/topNews")


;Initialize
TickerGuiStart:
TickerItem:=Array()
TickerLabelhWnd:=Array()
TickerLabelUrl:=Array()
SetTimer,TickerRss,% TickerRssRefresh*60000
Gosub,TickerRss
Gui,Ticker:Default
Gui,+ToolWindow -SysMenu -Caption +LastFound hwndTickerhWnd
Gui,Margin, 5,5
Gui,Color,%TickerBackgroundColor%
WinSet,ExStyle,+0x20
WinSet,Transparent,%TickerTransparancy%
Gui,Font,c%TickerTextColor% s%TickerTextSize% w%TickerTextWeight%,%TickerTextFont%
SysGet,TickerMon,MonitorWorkArea
Loop, % TickerMessageQueue
{
    Gui,Add, Text, x%TickerMonRight% y5 hwndTickerLabelhWndtemp,
    TickerLabelhWnd.Insert(TickerLabelhWndtemp)
    TickerLabelUpdate()
}
VarSetCapacity(TickerLabelhWndtemp,0)

TickerGuiH:=GetTextSize("Text", "s" TickerTextSize " w" TickerTextWeight, TickerTextFont, 1)
TickerGuiH:=SubStr(TickerGuiH,Instr(TickerGuiH,",")+1)+10
TickerGuiY:=TickerTopOfScreenInsteadOfBottom ? "0" : TickerMonBottom-TickerGuiH

Gui,Show, x0 y%TickerGuiY% w%TickerMonRight% h%TickerGuiH% NoActivate
WinSet,% TickerTopMostInsteadOfBottom ? "Topmost" : "Bottom",,ahk_id %TickerhWnd%
SetTimer,TickerUpdate,%TickerTimer%

Hotkey,If, MouseOver(TickerhWnd)
Hotkey,%TickerButton%,TickerClick,On
Hotkey,If,
Return

TickerUpdate:
    TickerUpdate()
Return

TickerRss:
    TickerRssUpdate()
Return

TickerGuiClose:
    Gui,Ticker:Default
    SetTimer,TickerRss,Off
    SetTimer,TickerUpdate,Off
    Hotkey,If, MouseOver(TickerhWnd)
    Hotkey,%TickerButton%,TickerClick,Off
    Hotkey,If,
    TickerLabelUpdate(1)
    TickerUpdate(1)
    Gui,Destroy
Return

F12::
TickerGuiToggle:
    If Winexist("ahk_id " TickerhWnd)
        Gosub,TickerGuiClose
    Else
        Gosub,TickerGuiStart
Return

TickerClick:
    WinSet,ExStyle,-0x20, ahk_id %TickerhWnd%
    MouseGetPos,,,,TickerClickControl
    WinSet, ExStyle,+0x20, ahk_id %TickerhWnd%
    If (SubStr(TickerClickControl,1,6)=="Static"){
        StringTrimLeft, TickerClickControl, TickerClickControl, 6
        If (SubStr(TickerLabelUrl[TickerClickControl],1,4)=="http")
            Run,% TickerLabelUrl[TickerClickControl]
    }
Return

#If, MouseOver(TickerhWnd)
#If,

TickerUpdate(Reset=0){
    global TickerMonRight, TickerMessageQueue, TickerLabelhWnd, TickerSeperation, TickerScrollSpeed, TickerhWnd, TickerPauseOnMouseover
    static TickerSlider, TickerMove, TickerMessageQueueIndex=1, Init=1
    If (Reset){
        Init:=1,TickerMessageQueueIndex=1
        Return
    }
    If Init
        TickerSlider:=TickerMonRight/4,TickerMove:=TickerScrollSpeed,Init=0

    SetControlDelay,-1
    TickerSlider-=TickerMove
    TickerSliderHelper:=TickerSlider
    Loop, % TickerMessageQueue
    {
        ControlGetPos,,,TickerLabelW,,, % "ahk_id " TickerLabelhWnd[TickerMessageQueueIndex]
        If (TickerSliderHelper<-TickerLabelW){
            TickerSlider+=TickerLabelW+TickerSeperation
            TickerSliderHelper:=TickerSlider
            TickerMessageQueueIndex:=mod(TickerMessageQueueIndex,TickerMessageQueue)+1
            ControlGetPos,,,TickerLabelW,,,% "ahk_id " TickerLabelhWnd[TickerMessageQueueIndex]
            TickerLabelUpdate()
        }
        ControlMove,, % TickerSliderHelper,,,,% "ahk_id " TickerLabelhWnd[TickerMessageQueueIndex]
        TickerSliderHelper+=TickerLabelW+TickerSeperation
        TickerMessageQueueIndex:=mod(TickerMessageQueueIndex,TickerMessageQueue)+1
    }

    If (TickerPauseOnMouseover){
        If MouseOver(TickerhWnd)
            If TickerMove<=0
                TickerMove=0
            Else
                TickerMove-=TickerScrollSpeed/40
        Else If (TickerMove<TickerScrollSpeed)
            TickerMove+=TickerScrollSpeed/10
    }
}

TickerLabelUpdate(Reset=0){
    Static TickerLabelIndex=1, TickerItemIndex=1
    global TickerItem, TickerShowDescription, TickerTextSize, TickerTextWeight, TickerTextFont, TickerLabelhWnd, TickerLabelUrl, TickerMonRight, TickerMessageQueue
   
    If (Reset){
        TickerLabelIndex:=1, TickerItemIndex:=1
        Return
    }

    Gui,Ticker:Default
    Text:=TickerItem[TickerItemIndex][1] (TickerShowDescription ? " - " TickerItem[TickerItemIndex][2] : "")
    ControlMove,,% TickerMonRight,,% GetTextSize(Text,"s" TickerTextSize " w" TickerTextWeight, TickerTextFont),,% "ahk_id " TickerLabelhWnd[TickerLabelIndex]
    ControlSetText,,% Text,% "ahk_id " TickerLabelhWnd[TickerLabelIndex]
    TickerLabelUrl[TickerLabelIndex]:=TickerItem[TickerItemIndex][3]

    If (TickerItemIndex==TickerItem.MaxIndex())
        TickerItemIndex:=TickerItem.MinIndex()
    Else
        For index in TickerItem
            If (index>TickerItemIndex){
                TickerItemIndex:=index
                Break
            }
   
    TickerLabelIndex++
    If (TickerLabelIndex>TickerMessageQueue)
        TickerLabelIndex=1
}

TickerRssUpdate(){
    global TickerItem:=Array(), TickerRss, TickerRssMaxItemsPerFeed, TickerRssBlockedWords, TickerRssMaxAgeHours
    For index, value in TickerRss
    {
        feed:=UrlDownloadToVar(value)
        startpos=1
        items=1
        Loop
        {
            pos:=RegExMatch(feed,"iUs)<item.*>.*</item>",item,startpos)
            If not pos
                Break
            startpos:=pos+StrLen(item)
            item:=RegExReplace(item,"iUs)<!\[CDATA\[(.+)\]\]>","$1")
            RegExMatch(item,"iUs)<title.*>(.*)</title>",title)
            If RegExMatch(title1, "i)" TickerRssBlockedWords)
                Continue
            RegExMatch(item,"iUs)<description.*>(.*)</description>",description)
            RegExMatch(item,"iUs)<link.*>(.*)</link>",link)
            RegExMatch(item,"iUs)<pubdate.*>(.*)</pubdate>",pubdate)
            itemage:=A_NowUTC
            itemage-=ParseRCF822Date(pubdate1, 1),Hours
            If (itemage>=TickerRssMaxAgeHours)
                Continue
            TickerItem.Insert([UnHTM(title1),UnHTM(description1),link1])
            If (items>=TickerRssMaxItemsPerFeed)
                Break
            items++
        }
    }
}

MouseOver(hWnd){
    CoordMode,Mouse,Screen
    MouseGetPos,mx,my
    WinGetPos,wx1,wy1,ww,wh,ahk_id %hWnd%
    wx2:=wx1+ww, wy2:=wy1+wh
    Return mx>=wx1 && mx<=wx2 && my>=wy1 && my<=wy2
}

ParseRCF822Date(datetime, UTC=0, centurythreshold=2010){
    ;Returns YYYYMMDDHH24MISS from a RFC822 or RSS PubDate date-time.
    static Needle:="i)([a-z]{3}),{0,1} (\d{1,2}) ([a-z]{3}) (\d{2,4}) (\d{1,2}):(\d{2}):{0,1}(\d{0,2}) ?([a-z0-9+-]{0,5})"
            , months:="Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec"
    FormatFloat:=A_FormatFloat, c:=0
    If !RegExMatch(datetime,needle,dt)
        Return False
    If (dt7="")
        dt7=0
    If (dt8="")
        dt8=z
   
    If (UTC){
        If RegExMatch(dt8,"^(\+|-)(\d{2})(\d{2})$",dtc)
            c:=dtc2*60+dtc3*(dtc1="+" ? 1 : -1)
        Else If RegExMatch(dt8,"i)^([a-z]{2,3})$")
            c:= (-4*!!RegExMatch(dt8,"i)EDT")-5*!!RegExMatch(dt8,"i)EST|CDT")-6*!!RegExMatch(dt8,"i)CST|MDT")-7*!!RegExMatch(dt8,"i)MST|PDT")-8*!!RegExMatch(dt8,"i)PST"))*60
        Else If RegExMatch(dt8,"i)^([a-z]{1})$")
            c:=(InStr("MLKIHGFEDCBAZNOPQRSTUVWXY",dt8)-13)*60
    }

    SetFormat,Float,04.0
    YYYY:= (dt4<100 ? dt4<Mod(centurythreshold,100) ? dt4+(centurythreshold//100)*100-100 : dt4+(centurythreshold//100)*100 : dt4)+0.0
    SetFormat,Float,02.0
    MM:=(InStr(months, dt3)//4)+1.0
    DD:=dt2+0.0
    HH24:=dt5+0.0
    MI:=dt6+0.0
    SS:=dt7+0.0
   
    SetFormat,Float,% FormatFloat

    Result:=YYYY . MM . DD . HH24 . MI . SS
    Result+=-c,Minutes
    Return Result
}

GetTextSize(pStr, pSize=8, pFont="", pHeight=false) {
    ;Laszlo: http://www.autohotkey.com/board/topic/16414-hexview-31-for-stdlib/page-2
    Gui TextSize:Font, %pSize%, %pFont%
    Gui TextSize:Add, Text, R1, %pStr%
    GuiControlGet T, TextSize:Pos, Static1
    Gui TextSize:Destroy
    Return pHeight ? TW "," TH : TW
}

UrlDownloadToVar(URL) {
    ;Eddy: http://www.autohotkey.com/board/topic/9529-urldownloadtovar/page-6  
    ComObjError(false)
    WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
    WebRequest.Open("GET", URL)
    WebRequest.Send()
    Return WebRequest.ResponseText
}

UnHTM( HTM ) { ; Remove HTML formatting / Convert to ordinary text by SKAN 19-Nov-2009
 Static HT ; Forum Topic: http://www.autohotkey.com/board/topic/47356-unhtm-remove-html-formatting-from-a-string-updated/
 IfEqual,HT,, SetEnv,HT, % "&aacuteá&acircâ&acute´&aeligæ&agraveà&amp&aringå&atildeã&au"
 . "mlä&bdquo„&brvbar¦&bull•&ccedilç&cedil¸&cent¢&circˆ&copy©&curren¤&dagger†&dagger‡&deg"
 . "°&divide÷&eacuteé&ecircê&egraveè&ethð&eumlë&euro€&fnofƒ&frac12½&frac14¼&frac34¾&gt>&h"
 . "ellip…&iacuteí&icircî&iexcl¡&igraveì&iquest¿&iumlï&laquo«&ldquo“&lsaquo‹&lsquo‘&lt<&m"
 . "acr¯&mdash—&microµ&middot·&nbsp &ndash–&not¬&ntildeñ&oacuteó&ocircô&oeligœ&ograveò&or"
 . "dfª&ordmº&oslashø&otildeõ&oumlö&para¶&permil‰&plusmn±&pound£&quot""&raquo»&rdquo”&reg"
 . "®&rsaquo›&rsquo’&sbquo‚&scaronš&sect§&shy­&sup1¹&sup2²&sup3³&szligß&thornþ&tilde˜&tim"
 . "es×&trade™&uacuteú&ucircû&ugraveù&uml¨&uumlü&yacuteý&yen¥&yumlÿ&apos'"
 TXT := RegExReplace( HTM,"<[^>]+>" ) ; Remove all tags between "<" and ">"
 Loop, Parse, TXT, &`; ; Create a list of special characters
   L := "&" A_LoopField ";", R .= (!(A_Index&1)) ? ( (!InStr(R,L,1)) ? L:"" ) : ""
 StringTrimRight, R, R, 1
 Loop, Parse, R , `; ; Parse Special Characters
  If F := InStr( HT, A_LoopField ) ; Lookup HT Data
    StringReplace, TXT,TXT, %A_LoopField%`;, % SubStr( HT,F+StrLen(A_LoopField), 1 ), All
  Else If ( SubStr( A_LoopField,2,1)="#" )
    StringReplace, TXT, TXT, %A_LoopField%`;, % Chr(SubStr(A_LoopField,3)), All
Return RegExReplace( TXT, "(^\s*|\s*$)") ; Remove leading/trailing white spaces
}
 
Last edited by Nextron on 08 Apr 2014, 18:58, edited 1 time in total.
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
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
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
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 (v1)”

Who is online

Users browsing this forum: No registered users and 103 guests