Toolbar Tutorial - Event Timers


Event timers enable you to execute commands in specific time intervals.

In this example we implement a simple event timer to display the current time.


Source:

<XML id="toolbar">
<TOOLBAR autosave=1 caption="Toolbar Tutorial">
<control type="toolbar">
<button id="home"

    caption="Download.com: "
    action="http://www.download.com"
    tooltip="Download.com Home Page"
    hidecaption=1
    image="http://www.toolbarbrowser.com/cnet/cnet1.ico">

</button>
<dropdown action="Menu(links)"></dropdown>
</control>

<control type="combo" id="query" action="Command(search); Command(history)" width=120></control>
<control type="toolbar">
<button caption="Search" tooltip="Search Download.com" image="http://www.toolbarbrowser.com/img/magnify.ico" action="Command(search); Command(history)"></button>
</control>
<control type="toolbar" id="navbar" value="button" valign=center style="navigation">
<button action="SearchPage(1); Command(history)" tooltip="Page 1"></button>
<button action="SearchPage(2); Command(history)" tooltip="Page 2"></button>
<button action="SearchPage(3); Command(history)" tooltip="Page 3"></button>
<button action="SearchPage(4); Command(history)" tooltip="Page 4"></button>
<button action="SearchPage(5); Command(history)" tooltip="Page 5"></button>
<button action="SearchPage(6); Command(history)" tooltip="Page 6"></button>
<button action="SearchPage(7); Command(history)" tooltip="Page 7"></button>
<button action="SearchPage(8); Command(history)" tooltip="Page 8"></button>
<button action="SearchPage(9); Command(history)" tooltip="Page 9"></button>
</control>
<control type="toolbar">
<button hidecaption=1 caption="Back" tooltip="Search Previous" image="http://www.toolbarbrowser.com/img/back.ico" action="SearchBack()"></button>
<button caption="Next" tooltip="Search Next" image="http://www.toolbarbrowser.com/img/next.ico" action="SearchNext()"></button>
<button caption="OS" action="SetText($OS)" tooltip="Display Operating System and Version" image="http://www.toolbarbrowser.com/img/info.ico"></button>
<button hidecaption=1 style="check" caption="highlight" action="Highlight(%QUERY%)" tooltip="Highlight Search Text" image="http://www.toolbarbrowser.com/img/highlight.ico"></button>
<button hidecaption=1 caption="Popups" tooltip="$BLOCKED popups blocked" action="PopupManager()" image="http://www.toolbarbrowser.com/img/popup_disable.ico"></button>
<separator></separator>
<button caption="Hot Files" tooltip="Hot Files from download.com" style=dropdown action="LoadMenu('http://export.cnet.com/export/download/rss-hot-download.com.com.xml',item,title,link,img:image,'http://www.toolbarbrowser.com/img/ie.ico')" image="http://www.toolbarbrowser.com/img/app_RankingAdvisor.ico"></button>
<separator></separator>

<control type=browser value="<html><body vlink=00ff00 alink=00ff00 link=00ff00 bgcolor=black topmargin=3 leftmargin=1><font face=verdana,courier size=-2 color=00FF00><marquee width="100%"><a target=_blank href=http://www.toolbarbrowser.com>Toolbar Browser Rocks!!!!!</a></marquee></body></html>" id=browser width=80>
</control>

<control type=toolbar hspace=5>
<button caption="$HH:$MI:$SS" id=time action="http://www.trellian.com/worldtime"></button>
<separator></separator>

<button caption="Games" tooltip="Games Software" image="http://www.toolbarbrowser.com/img/ie.ico" action="http://www.download.com/Games/2001-2012-0.html?tag=dir">
</button>

<button caption="Internet" tooltip="Internet Software" image="http://www.toolbarbrowser.com/img/ie.ico" action="http://www.download.com/Internet/2001-2017-0.html?tag=dir">
</button>

<button caption="Utilities" tooltip="Utilities & Drivers" image="http://www.toolbarbrowser.com/img/ie.ico" action="http://www.download.com/Utilities/2001-2018-0.html?tag=dir">
</button>

<button caption="Business" tooltip="Business Softwae" image="http://www.toolbarbrowser.com/img/ie.ico" action="http://www.download.com/Business/2001-2010-0.html?tag=dir">
</button>
</control>

<MENUDEFINITIONS>
    <menu id="links">
    <option caption="Download.com" action="http://www.download.com"></option>
    <separator></separator>
    <option caption="Software" action="http://www.download.com/2001-20_4-0.html?tag=tab"></option>
    <option caption="Music" action="http://music.download.com/2001-1_32-0.html?tag=tab"></option>
    <option caption="Games" action="http://www.download.com/2001-2012_4-0.html?tag=tab" image="http://www.toolbarbrowser.com/img/smiley.ico"></option>
    </menu>

</MENUDEFINITIONS>

<COMMANDS>
    <command id="history" action="DeleteOption(query,%QUERY%); SetOption(query,%QUERY%); TruncateOption(query,20); SetCaption(query,%QUERY%); Save()"></command>
    <command id="search" action="Search('http://www.download.com/3120-20-0.html?qt=%QUERY%&tg=dl-2001&search.x=17&search.y=2',
    'http://www.download.com/3120-2001-0-2-0.html?qt=%_QUERY%&ca=2001&excl=10304226&excl=10308849&excl=10265867&excl=10283988&excl=10291260',
    'http://www.download.com/3120-2001-0-3-0.html?qt=%_QUERY%&ca=2001&excl=10304226&excl=10308849&excl=10265867&excl=10283988&excl=10291260')"
    ></command>

    <timer id=date delay=1 action="SetCaption(time,'$HH:$MI:$SS')"></timer>

</COMMANDS>

</TOOLBAR>
</XML>





Remarks:

  • Note the TIMER the tag in the commands block. The timer updates the button caption once every second.

  • The minimum time delay is 1 second.

  • You can use timers to import data from XML files. This can be very useful to update real-time statistics such as stock quotes, Pay Per Click bids, news headlines etc. You can also use a timer to refresh the current page to prevent inactivity logouts.



































Toolbar Browser Rocks!!!!! " id=browser width=80>
























>