FeedDemon RSS reader among others things has Watches functions. Instead of specific RSS it searches feeds for keywords and combines found items together into mashup.
It works very well except that manual input of keywords is too troublesome to create complex Watches. I wanted to create Watch integrated with Appnews internals and started to look for external keywords edit.
C:\Documents and Settings\[profile]\Local Settings\Application Data \FeedDemon\v1\Watches\
That folder has bunch of files with really cryptic names and .RSSW extensions. Inside each file is XML that holds all setting for a watch, including set of keywords:
Something like this:
<watch xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/" version="1.6" fd:feedId="D40C7E27-19C1-45FF-AE7A-3B85054531BF" fd:autoPurgeEnabled="true" fd:autoPurgeMaxItems="50"> <title>Appnews</title><fd:state fd:numUnread="0" fd:numFlagged="0" fd:numTotal="50"/> <location title="true" description="false"/><options wholeWords="true" matchCase="false" matchAllWords="false" markReadInSourceFeed="false"/> <keyword>Appnews</keyword></watch>
So after creating Watch in FeedDemon I can find it by <title> and add all <keyword> I need.
As always AutoIt is my first choice for simple programming tasks. I decided to make a function that will:
- Find specific Watch file by Watch name.
- Change keywords in Watch as I need.
Step by step
Start. Array include is needed for some functions down the road. Function declaration – takes two parameters – name of Watch to edit and array of keywords.
#include <Array.au3> Func UpdateWatch($title,$array)
Set up Watches directory and stops if not found. Uses @UserProfileDir macros to include profile of user in path.
$path=@UserProfileDir&"\Local Settings\Application Data \FeedDemon\v1\Watches\" If Not FileExists($path) Then MsgBox(0,"","Watches directory not found") Return EndIf
Set up search for specific Watch. Little tricky to understand but that’s how general file search mechanics in Windows go. Change directory to Watches, try to look for files that fit *.rssw format, stop if not found.
FileChangeDir($path) $search=FileFindFirstFile("*.rssw") If $search=-1 Then MsgBox(0,"","Search error") Return EndIf
Actual search. We are going through all files, looking for the one that has title equal to what was passed to function. If nothing is found we break search and stop function.
$watch=False $pattern="<title>"&$title&"</title>" While Not $watch $file = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileRead($file),$pattern) Then $watch=$file WEnd FileClose($search) If Not $watch Then MsgBox(0,"","Watch not found") Return EndIf
Keywords array preparation. For each item in array passed to function content is enclosed in keyword tags.
$s=UBound($array)-1 For $i=0 To $s $array[$i]="<keyword>"&$array[$i]&"</keyword>" Next
File edit. Read Watch file. Replace everything from start of keywords to the end with keywords from array. Write file back (with creating backup copy to be safe).
$xml=FileRead($watch) FileCopy($watch,$watch&".bak") $pattern="(<keyword>.*)" $replace=_ArrayToString($array,"")&"</watch>" $xml=StringRegExpReplace($xml,$pattern,$replace) FileDelete($watch) FileWrite($watch,$xml) EndFunc
And all together:
For results to show up in FeedDemon it must be restarted after running function.
So instead of tedious manual input now I just feed list of program titles from Appnews managing software into Watch. Ensures that I don’t miss anything and (at times) makes me feel great when I beat software portals at update speed. :)
What would you track with large list of keywords?