Monday, November 08, 2010 at 12:04 AM.

on systemTrayIconRightClick (adradrmenu) {
		<<1/3/03; 12:46:07 PM by JES
			<<Added support for serial number renewals. If the serial number is expired, add a command to renew your license instead of the Update Radio.root command.
		<<9/2/02; 8:49:32 PM by JES
			<<For the Windows-only Exit and Shut Down Radio command, call through the windowTypes Quit command handler instead of calling filemenu.quit directly. This makes sure that all changed databases will get saved when quitting, and is the same thing that the File -> Quit command does in the Radio application.
		<<12/18/01; 3:57:29 PM by PBS
			<<New commands: Update Radio.root, Upstreaming, Work Offline, Open www folder.
		<<12/2/01; 7:44:41 PM by JES
			<<If is true, only add the Enter Serial Number and Exit and Shut Down Radio commands.
		<<11/12/01; 8:57:45 PM by PBS
			<<Only add Open Radio and Exit and Shut Down Radio commands on Windows.
			<<Because: for Open Radio, Radio isn't really hidden.
			<<For Exit..., there's automatically a Quit menu item in the contextual menu. (Placed there by the OS.)
	local (adrMenu = @system.temp.systemTrayRightClickMenu);
	new (menubartype, adrmenu);
	local (oldtarget = target.set (adrmenu));
	local (menuname = "Right-Click Menu");
	op.firstSummit ();
	op.setLineText (menuname);
	on addCommand (itemName, scriptString) {
		menu.addMenuCommand (adrMenu, menuName, itemName, scriptString)};
	on addSeparator () {
		op.insert ("-", down)};
	if {
		addCommand ("Enter Serial Number", "radio.menuCommands.openPage (")}
	else { //add the Home Page command
		addCommand ("Home Page", "radio.menuCommands.openPage (")};
	if system.environment.isWindows {
		if not {
			addCommand ("Open Radio", "Frontier.bringToFront ()")}};
	addSeparator ();
	bundle { //PBS 12/18/01: Update Radio.root
		local (command = "Update Radio.root");
		if tcp.isOffline () {
			addCommand ("(" + command, "")}
		else { //JES 1/3/03: update or renew
			local (flEnabled = true);
			if defined ( { //sn check
				local (whenExpires = date (;
				if whenExpires < () {
					flEnabled = false}};
			if flEnabled {
				addCommand (command, "rootUpdates.threadedUpdate (@root)")}
			else { //instead add a command for entering your renewal code
				local (url = string.replace (, "<%serialNumber%>",;
				addCommand ("Renew Radio...", "radio.menuCommands.openCloudPage (\"" + url + "\")");
				addSeparator ()}}};
	if not (date.versionLessThan (Frontier.version (), "7.1b42")) { //needs kernel support for checked menu items
		bundle { //PBS 12/18/01: Upstreaming
			local (command = radio.upstream.menuFormula ());
			addCommand (command, "radio.upstream.menuCommand ()")};
		bundle { //PBS 12/18/01: Work Offline
			local (command = "Work Offline");
			local (flChecked = ("workoffline"));
			if flChecked {
				command = "!" + command};
			addCommand (command, " ()")}};
	bundle { //PBS 12/18/01: Open www folder
		local (scriptString = "file.openfolder (;if system.environment.isMac{Finder.bringToFront ()}");
		local (command = "Open www folder");
		addCommand (command, scriptString)};
	if system.environment.isWindows {
		addSeparator ();
		addCommand ("Exit and Shut Down Radio", " (\"quit\")")};
	try {target.set (oldTarget)};
	adradrmenu^ = adrmenu;
	return (true)}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.