Jump to content


Photo

AutoHotkey Support Forums RSS Feed Notifier


  • Please log in to reply
3 replies to this topic

#1 Leo Xiong

Leo Xiong
  • Members
  • 107 posts

Posted 14 July 2012 - 02:34 PM

Broken until the new AutoHotkey forums has a RSS feed.

 

AutoHotkey Support Forums RSS Feed Notifier

Eager to help other but always find the questions in the support forums answered? Then try this out. This script will periodically check for updates by downloading and parsing the RSS feed and give you a gentle notification at the corner of your screen.

xpath v3 - read and write XML documents with XPath syntax is required in your library or be #included.

AutoHotkey Forums RSS Feed Notifier Screenshot.png

 

 

#SingleInstance, Force
CoordMode, Mouse, Relative
FileEncoding, UTF-8

if (!FileExist("media\viewSite.png"))
	URLDownloadToFile, http://www.google.com/s2/u/0/favicons, media\viewSite.png
if (!FileExist("media\viewSite2.png"))
	URLDownloadToFile, http://www.txttext.com/assets/viewSite2.png, media\viewSite2.png

SysGet, screen, MonitorWorkArea

Menu, Tray, NoStandard
Menu, Tray, Add, Show Latest, showGui
Menu, Tray, Default, Show Latest
Menu, Tray, Add, Update, checkRSS
Menu, Tray, Add
Menu, Tray, Add, Exit, exit

Gui, -Caption +AlwaysOnTop +Border +HWNDguiHWND +LastFound +ToolWindow
Gui, Color, F9F9F9
Gui, Font, s14, Segoe UI Light
Gui, Add, Text, x160 y0 h24 c909090 Right vtextHeading, new forum post
Gui, Font, Bold s9
Gui, Add, Text, x10 y24 w330 h30 c3B3B3B vtextSubHeading
Gui, Font, Normal
Gui, Add, Text, x27 y60 w309 h15 c313131 vtextFooter Right
Gui, Add, Picture, x5 y59 HWNDpictureHWND vpictureViewSite gpictureViewSite, media\viewSite.png
Gui, Add, Progress, x5 w330 h5 y80 cB0B0B0 vprogress
Gui, Show, % "x" screenRight - 342 " y" screenBottom - 92 " w340 h90 Hide", AutoHotkey Forums RSS Feed Notifier

OnMessage(0x200, "WM_MOUSEMOVE")
SetTimer, checkRSS, 120000

checkRSS:
if (!DllCall("Wininet.dll\InternetGetConnectedState", "Str", 0x43, "Int", 0)){
	TrayTip, AutoHotkey Forums RSS Feed Notifier, Unable to connect to the internet..., 2, 3
	return
}
URLDownloadToFile, http://www.autohotkey.com/community/feed.php?f=1, media\autoHotkeyForumsFeed.xml
xpath_load(autoHotkeyForumsFeed , "media\autohotkeyForumsFeed.xml")
FileDelete, media\autoHotkeyForumsFeed.xml
if (rssID != xpath(autoHotkeyForumsFeed, "/feed/entry[1]/id/text()")){
	showGui:
	rssID := xpath(autoHotkeyForumsFeed, "/feed/entry[1]/id/text()")
	textSubHeading := xpath(autoHotkeyForumsFeed, "/feed/entry[1]/title/text()")
	GuiControl,, textSubHeading, % textSubHeading
	GuiControl,, textFooter, % "last updated: " xpath(autoHotkeyForumsFeed, "/feed/entry[1]/updated/text()") " by " (autoHotkeyForumsFeed, "/feed/entry[1]/author/name/text()")
	DllCall("AnimateWindow", "UInt", guiHWND, "Int", 180, "UInt", "0xA0000")
	A_TickCount2 := A_TickCount
	while, ((A_TickCount3 := A_TickCount - A_TickCount2) <= 5000) or (mouseWin = guiHWND){
		MouseGetPos,,, mouseWin
		GuiControl,, progress, % A_TickCount3 / 5000 * 100
	}
	DllCall("AnimateWindow", "UInt", guiHWND, "Int", 800, "UInt", "0x90000")
	return
}

return
exit:
ExitApp

return
pictureViewSite:
Run, % rssID

return
WM_MOUSEMOVE(){
	static
	if (A_GuiControl2 != A_GuiControl){
		if (A_GuiControl = "pictureViewSite")
			GuiControl,, pictureViewSite, media\viewSite2.png
		else
			GuiControl,, pictureViewSite, media\viewSite.png
		A_GuiControl2 := A_GuiControl
	}
}


#2 MasterFocus

MasterFocus
  • Moderators
  • 4131 posts

Posted 16 July 2012 - 05:36 AM

Looks nice (I can't test it now)! :)

I have recently checked the RSS feed and I noticed that the title of each entry is
Category • Re: Title here
I suppose this is intended.

However, when using a desktop RSS aggregator, I find it a bit annoying because
[1] I can't successfully group entries by title ( "Category • Title here" != "Category • Re: Title here" )
[2] I don't know much about RSS feeds, but I noticed the current forum feed adds a new entry everytime a topic has new content, istead of updating a previous entry for that topic.

I probably won't have much spare time this week, otherwise I'd tweak your code a little bit to remove "Re:" from all titles and exclude duplicate enties (by title).

#3 Leo Xiong

Leo Xiong
  • Members
  • 107 posts

Posted 16 July 2012 - 05:43 AM

Looks nice (I can't test it now)! :)

Thanks!

I probably won't have much spare time this week, otherwise I'd tweak your code a little bit to remove "Re:" from all titles and exclude duplicate enties (by title).

I guess I can remove them with StringReplace or RegExReplace, the script currently downloads the RSS from here, so you will receive a notification when a thread is sent (both new posts or replies). There is also feed for new topics only too <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/feed.php?mode=topics">feed.php?mode=topics</a><!-- l -->.

#4 Guest

Guest
  • Guests

Posted 05 October 2012 - 12:42 AM

Works great!!! :D