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

on uninstallSubMenu (menuName) {
	<<Uninstall a Tool's sub-menu from the Tools menu.
			<<10/04/00; 5:25:14 PM by PBS
				<<Do a case-insensitive comparison on the name
			<<10/06/00; 10:05:37 PM by PBS
				<<Make sure the target gets restored no matter what path is taken.
			<<11/08/00; 6:35:40 PM by PBS
				<<Protect the Tools menu with a semaphore.
			<<11/28//00; 10:10:27 PM by JES
				<<Unlock the semaphore after the submenu is deleted, but before returning.
			<<11/30/00; 1:55:24 AM by JES
				<<Deal properly with removal of submenus which contain space characters.
	local (lowerMenuName = string.lower (menuName));
	local (adrToolsMenu =;
	local (oldTarget = target.set (adrToolsMenu));
	try {
		semaphore.lock (adrToolsMenu, 7200)}
	else {
		semaphore.unlock (adrToolsMenu)};
	op.firstSummit ();
	op.expand (1);
	local (dir = right, linetext = op.getLineText (), flNewMenu = true);
	while linetext != "-" {
		if string.lower (string.innerCaseName (linetext)) == lowerMenuName { //PBS 10/04/00: case-insensitive comparison
			op.deleteLine ();
			try {target.set (oldTarget)};
			semaphore.unlock (adrToolsMenu);
			return (true)};
		op.go (dir, 1);
		if dir == right {
			dir = down};
		linetext = op.getLineText ()};
	semaphore.unlock (adrToolsMenu);
	try {target.set (oldTarget)};
	return (false)}

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.