[Windows Mobile Apps and Games] :
RSS Script / Widget

Here's a MortScript I wrote that can be used in conjunction with WMD's RegInfo widget, or could be the backbone for a full fledged RSS widget. This script has a bunch of configurable options in it to make it more useful to you. This works pretty much like the MortScript included in Goraps Weather.

Pretty much what it does is download the XML from an RSS feed, strip the relevent data out of it, and plugs it into your registry. You can then use, i.e., WMD's RegInfo widget to point to a few items in your registry to have RegInfo display the current top news. I'll explain the registry structure after the install instructions. The script by default is set to load top stories from FoxNews.com, but you can easily change this.

INSTALLATION:

1. Install MortScript if you haven't already.

2. Run the MortScript.exe at least once so it can associate itself with .mscr script files.

3. Place this script "RSSFeed.mscr" anywhere on your device, even the card if you want.

4. Rename the "RSSFeed.mscr" to "RSSFeed.mscr.txt" using Total Commander, File Explorer or Resco Explorer.

5. Double tap or click enter on the file after you rename it and it will open in Pocket Word. Scroll down a couple lines to where it says "User Settings".

6. Adjust the settings to your own preferences and then close Pocket Word. When it asks you if you want to save it in Pocket Word format click "NO"!

7. Rename the file to "RSSFeed.mscr" again.

TO USE WITH REGINFO

1. Under items in the settings.txt file, add a new item to point to HKLM\Software\RSSScript\RSSFeed1\Items\1, Title (this loads just one article into the RegInfo widget, if you want more articles displayed, add another item and change the “1” as in above, to a “2”, “3” and so forth, for as many articles as you want, but obviously no more than you specified the script to download in your settings).

2. I have mine setup with an icon that just links to "foxnews.mobi" which is their mobile friendly version.

CONFIGURING THE SCRIPT

All of the user configurable options in this script have explanations for the options above each option. If you're confused about something just pipe up here in this thread.

########################
# User Settings #
########################
# Address to RSS feed.
RSSFeed = "http://feeds.foxnews.com/foxnews/latest"
# Registry title, only necessary if more
# than one feed is setup.
RSSTitle = "RSSFeed1"
# Max number of items/articles to grab:
MaxItems = 6
# Alternate link - Most RSS feeds link to
# the full web version of articles. The
# link put here will be used instead of a
# transcoded version.
AltLink = "http://foxnews.mobi"
# A transcoder converts a full web page
# to a mobile friendly version.
Transcoder="http://google.com/gwt/n?u="
# UseTranscoder = YES or NO. If Yes,
# the article link will use the transcoder
# listed above. If No, it will use the
# AltLink listed above.
UseTranscoder = YES
# Connection allowed, TRUE or FALSE
startconn = TRUE
# Use Autorefresh? "true" or "false"
autorefresh = TRUE
# Number of minutes until next refresh
refreshInterval = 120
# Get path to script - don't change!
instPath = SystemPath( "ScriptPath" )
# Path to MortScript. Only necessary
# if autorefresh is set to true.
pathToMortScript = "\Storage Card\Program Files\MortScript\mortscript.exe"
# File name of this script. Necessary for
# Autorefresh if you have more than one
# of these feed scripts setup.
ScriptName="RSSFeed.mscr"
# Some tags such as <title> often
# contain meta data that isn't very
# pretty. Include the meta characters
# that encapsulate the title here to
# remove it.
# The first variable corresponds to the
# beginning of the tag, the second to
# the end.
stripData1 = "<![CDATA["
stripData2 = "]]>"
########################
# End User Settings #
########################

NOTES ABOUT SETTINGS

Because I was hoping that this could be turned into it's own widget, there's a few options that don't do anything if just used with WMD's RegInfo Widget:

1. The transcoder and alternate link options give the user the option of what link to load if the news article is clicked. All this does is put the appropriate link in the registry for the coinciding article. By default, I have it create a Google mobile transcoded link to the full (PC version) article. If you tell it NO, to not use the transcoder, then it will link to the alternative link (AltLink) you specify. This is because RSS feeds don't feature links to a "mobile" version (yet). You could, however, use the AltLink to link to, i.e., "http://foxnews.mobi" which will display the same articles the widget does on your device, you then just have to select the article to read it, which just isn't as fluid as it just "popping up."

2. Obviously without a widget to manage the data, auto refreshing is useless, but it's there just in case :) But, what this does do in the background is automatically update the articles in the registry every XX minutes (probably once or twice a day are more than enough).

3. RSSTitle and ScriptName are required if you want to setup more than one feed. All you have to do is change the RSSTitle for the new one (to RSSFeed2 for instance), and rename the entire script to something else as well, so you can load it with your new settings.

4. StripData1 & 2. For some reason, the FoxNews feed had strange meta data wrapped around the title. Just plug any weird characters in here if you want them automatically removed so your article titles don't get displayed like <![CDATA[Aliens Invading Earth, Run!]]>.

FOR WIDGET DEVELOPERS

I actually wrote this as a back-end hoping another developer could build the widget front-end for me. My idea for the widget would be to display rotating news article titles, which when clicked load the actual story in the web browser.

The script downloads an RSS feed and parses it to the registry, indexing by article number. Each article entry contains a registry key (string) for it's "Title", "Link" and "Description". When done parsing, it drops a dword key in the root containing the number of articles downloaded. There is also a key (string) that if monitored by a widget, tells what the status of the script is (it's called "Status"). When the update is done, "Status" contains the time and date of the last download.

HKLM\Software\Qkzoo\RSSScript\RSSFeed1

-NumItems (Number of downloaded articles)

-Status (Current status of the script, or time of last download)

HKLM\Software\Qkzoo\RSSScript\RSSFeed1\1

-Title

-Link

-Description

...

HKLM\Software\Qkzoo\RSSScript\RSSFeed1\6 (etc.)

-Title

-Link

-Description

I know I'm long winded but I like to be thorough!

Q :eek: