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

system.verbs.builtins.Frontier.tools.installSubMenu

on installSubMenu (adrMenu) {
	<<Install a tool's menu as a sub-menu in the Tools menu.
		<<Thursday, September 28, 2000 at 10:51:13 PM by JES
		<<Changes:
			<<11/08/00; 6:35:56 PM by PBS
				<<Protect the Tools menu with a semaphore.
			<<12/20/00; 10:23:36 AM by JES
				<<Install Tools sub-menus in alphabetical order.
	
	local (adrToolsMenu = @Frontier.tools.menu);
	local (oldTarget = target.set (adrMenu));
	op.firstSummit ();
	local (menuName = op.getLineText ()); //get name of this tool's menu
	
	try {
		semaphore.lock (adrToolsMenu, 7200)}
	else {
		semaphore.unlock (adrToolsMenu)};
	target.set (adrToolsMenu);
	op.firstSummit ();
	op.expand (1);
	local (dir = right, linetext = op.getLineText (), flNewMenu = true);
	while (linetext != "-") { //search for the sub-menu -- it may already exist in the Tools menu
		if string.lower (linetext) == string.lower (menuName) {
			flNewMenu = false};
		op.go (dir, 1);
		if dir == right {
			dir = down};
		linetext = op.getLineText ();
		if linetext > menuName { //12/20/00 JES: make tools submenus alphabetical
			break}};
	if flNewMenu { //it doesn't exist -- add an entry for this sub-menu
		op.insert (menuName, up)};
	
	menu.addSubMenu (adrToolsMenu, "Tools", adrMenu); //actually add the sub-menu
	
	semaphore.unlock (adrToolsMenu);
	try {target.set (oldTarget)};
	return (menuName)}



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.