The following example shows how to construct the CDF string listed below:
<?XML version="1.0"?>
<CHANNEL HREF="http://www.mysite.com/Channel/homepage.htm"
BASE="http://www.mysite.com/Channel/">
<TITLE>Sample "Color" Channel</TITLE>
<ABSTRACT>The sample color channel contains a red, green, and blue page for viewing.</ABSTRACT>
<LOGO HREF="logo_big.gif" STYLE="IMAGE-WIDE"/>
<LOGO HREF="logo_med.gif" STYLE="IMAGE"/>
<SCHEDULE STARTDATE="1997-09-23">
<INTERVALTIME DAY="1" />
<EARLIESTTIME HOUR="2" />
<LATESTTIME HOUR="6" />
</SCHEDULE>
<ITEM HREF="page1.htm">
<LOGO HREF="red.gif" STYLE="ICON"/>
<TITLE>The Red Page</TITLE>
<ABSTRACT>This is the abstract description for the red page.</ABSTRACT>
</ITEM>
<ITEM HREF="page2.htm">
<LOGO HREF="green.gif" STYLE="ICON"/>
<TITLE>The Green Page</TITLE>
<ABSTRACT>This is the abstract description for the green page.</ABSTRACT>
</ITEM>
<ITEM HREF="page3.htm">
<LOGO HREF="blue.gif" STYLE="ICON"/>
<TITLE>The Blue Page</TITLE>
<ABSTRACT>This is the abstract description for the blue page.</ABSTRACT>
</ITEM>
<ITEM HREF="scrnsave.htm">
<USAGE VALUE="ScreenSaver"></USAGE>
</ITEM>
</CHANNEL>
The example below builds a Project object defining the content.
' Using VBScript and Windows Scripting Host Runtime Env
Dim Project
Set Project = CreateObject("Push.Project")
Project.Name="ColorChannel"
' Add the logos to the project
call Project.AddLogo("Top-Big","logo_big.gif", "IMAGE-WIDE")
call Project.AddLogo( "Top-Med","logo_med.gif", "IAMGE")
call Project.AddLogo( "Red" , "red.gif", "ICON")
call Project.AddLogo( "Green" , "green.gif", "ICON")
call Project.AddLogo( "Blue" , "blue.gif", "ICON")
' set up the channel
Project.Channel.HREF="http://www.mysite.com/Channel/homepage.htm"
Project.Channel.BASE="http://www.mysite.com/Channel/"
Project.Channel.Title="Sample "Color" Channel"
Project.Channel.Abstract="The sample color channel contains a red, green, and blue page for viewing."
' attach the logos to the channel itself
Project.Channel.LogoRefs.Add "Top-Big"
Project.Channel.LogoRefs.Add "Top-Med"
' set up the schedule element
Project.Channel.Schedule.Startdate=#1997-09-23#
Project.Channel.Schedule.Intervaltime=1
Project.Channel.Schedule.Earliesttime=2
Project.Channel.Schedule.Latesttime=6
' now add the items
Dim Item
' Red item
Set Item = Project.Channel.AddItem
Item.HREF="page1.htm"
Item.Title="The Red Page"
Item.Abstract="This is the abstract description for the red page."
Item.LogoRefs.Add "Red"
' Green item
Set Item = Project.Channel.AddItem()
Item.HREF="page2.htm"
Item.Title="The Green Page"
Item.Abstract="This is the abstract description for the green page."
Item.LogoRefs.Add "Green"
' Blue item
Set Item = Project.Channel.AddItem()
Item.HREF="page3.htm"
Item.Title="The Blue Page"
Item.Abstract="This is the abstract description for the blue page."
Item.LogoRefs.Add "Blue"
' Screensaver item
Set Item = Project.Channel.AddItem()
Item.HREF="scrnsave.htm"
Item.AddUsage "ScreenSaver"
' Save the project (very important!)
Call Project.Save "ColorChannels"
' write the CDF file to disk
Call Project.WriteCDFFile("c:\channels\color\color.cdf")
This example, although not very interesting, does illustrate the core features of the primary Active Channel Objects. A more interesting use of these objects is in an Active Channel Agent that searches the system for content that meets certain conditions to be included in the Channel object during the refresh cycle.