Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 1 of 1
  1. #1
    Join Date
    Nov 2006
    Location
    Quebec, Canada.
    Posts
    432

    RSS News Reader Project *needs improvement*

    Here's what I posted in the AMS7 forums, but it's also compatible with AMS6. That was done in about 2 hours

    Regarding my code, you're allowed to use it in another app but don't just do a news reader. This would be 60% or more of only my code. Please use your own code, too.

    The *.apz is attached. It was done in AMS6, so it's compatible with 6 and 7. Code should be backwards compatible...
    All the code is in Global Functions and a little part is on "Refresh" button. I used customs function table, so it's easier
    A plug-in could even be done with this!

    Any improvements are welcome top be shared, especially to show more that the first item however I don't really know the use of loops, so... masters, please help!

    My code:
    Code:
    --##################################
    --## Custom Function Informations ##
    --##################################
    -- Disclaimer: This code might have bugs, but I did all I could to remove most of them.
    --You are allowed to use this on a commercial app, however DO NOT USE THIS ONLY AS AN APP. T
    -- A linkback/credit is not needed, but would be appreciated.
    -- Done by: FoxLeader
    --URL: http://www.foxleader.net
    -------------------------------------------------------
    -- Language Vars:
    	--Publish date
    		published = "Publié: "
    	--Open new's link
    		openLink = "Ouvrir la nouvelle"
    	--"Downloading" text for status message
    		msgDownloading = "Connexion..."
    	--"Loading" text for status message
    		msgLoading = "Traitement en cours..."
    	--Properties of the status text
    		RSS_StatusProp = {}
    		RSS_StatusProp.Enabled = false
    		RSS_StatusPropColor = "FFFFFF" --In Hexadecimal
    		RSS_StatusProp.ColorNormal = Math.HexColorToNumber(RSS_StatusPropColor); --Don't change this
    		RSS_StatusProp.X = 920
    		RSS_StatusProp.Y = 10
    		RSS_StatusProp.FontSize = 8
    --## Vars:
    	--"url" is the url of the (online) RSS feed
    	--"dir" is the target directory to download to
    -------------------------------------------------------
    
    --[[ Usage:
    	Put this (exemple) OnShow or on any button:
    		RSS.Get("http://www.indigorose.com/forums/external.php?type=rss", _SourceFolder.."AutoPlay\\Docs\\feed.xml")
    	to download the feed. Then, put this (exemple again) where you want it: 
    	RSS.Load("Feed", true)
    	
    	You absolutely need the following objects:
    		Feed_Name (Label)
    		Feed1_Content (Paragraph)
    		Feed1_Title (Label)
    		Feed1_Title (Label)
    		
    	That's it! Any enhancements are welcome. Share them on the forums!
    ]]
    
    RSS = {}
    
    function RSS.ShowStatus(show, type)
    	if show == true then		
    		Page.CreateObject(OBJECT_LABEL, "RSS_Status", RSS_StatusProp);
    		
    		--Types:
    			--1 is download
    			--2 is loading
    		if type == 1 then
    			Label.SetText("RSS_Status", msgDownloading)
    		elseif type == 2 then
    			Label.SetText("RSS_Status", msgLoading)
    		end
    		
    	elseif show == false then
    		Page.DeleteObject("RSS_Status");
    	end
    end
    
    function RSS.Get(url, dir, showStatus)
    	--Show the message
    	RSS.ShowStatus(true, 1)
    	--Download the feed
    	HTTP.Download(url, dir, MODE_BINARY, 20, 80, nil, nil, nil);
    	XML.Load(dir);
    	--Hide the message
    	RSS.ShowStatus(false)
    end
    
    function RSS.Load(prefix, titleClick, showStatus)
    	--Show the message
    	RSS.ShowStatus(true, 2)
    	
    	--[ Will be removed when enhanced as a loop (Start)]
    		no = 1
    	--[ Will be removed when enhanced as a loop (End) ]
    	--Get the feed name
    	name = XML.GetValue("rss/channel/title");
    	--Show the feed name
    	Label.SetText(prefix.."_Name", name);
    	
    	--Get the first item's values
    	title = XML.GetValue("rss/channel/item/title");
    	link = XML.GetValue("rss/channel/item/link");
    	description = XML.GetValue("rss/channel/item/description");
    	pubDate = XML.GetValue("rss/channel/item/pubDate");
    	
    	--Show the feed's title
    	Label.SetText(prefix..no.."_Title", title);
    	--Add an OnClick, cursor and tooltip on the title if enabled
    	if titleClick == true then
    		--OnClick
    		linkScript = "File.Open(link, '', SW_SHOWNORMAL);"
    		Page.SetObjectScript(prefix..no.."_Title", "On Click", linkScript);
    		
    		--Tooltip & Cursor
    		titleClick_Propert = {}
    		titleClick_Propert.TooltipText = openLink
    		titleClick_Propert.Cursor = CURSOR_HAND
    		Label.SetProperties(prefix..no.."_Title", titleClick_Propert);
    	end
    	--Show the date
    	Label.SetText(prefix..no.."_Date", published..pubDate);	
    	--Show the feed's content (description)
    	Paragraph.SetText(prefix..no.."_Content", description)
    	
    	RSS.ShowStatus(false)
    end
    I try to also give back a little bit!
    Attached Files

Similar Threads

  1. Running Adobe Acrobat Reader Directly from the CD-ROM
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-26-2003, 09:22 AM
  2. Anyone use Acrobat Reader 6 in AMS project yet?
    By kpsmith in forum AutoPlay Media Studio 4.0
    Replies: 6
    Last Post: 06-02-2003, 08:56 AM
  3. HOWTO: Open a Version 3.0 Project in Version 4.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-30-2002, 02:09 PM
  4. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts