Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.bookmarksMenu.addBookmark
on addBookmark (adrLogic, adrTitle) { // add a bookmark command to the Bookmarks menu
<<06/24/01; 3:34:30 AM by JES
<<Add a command to the Bookmarks menu.
<<Call this script to add a bookmark.
<<adr is the address of the window.
<<adrLogic is the address of the script which envokes the bookmark
<<adrTitle is the address of a string to use for the bookmark command's name
local (adrmenu = bookmarksMenu.init ());
local (menuname);
bundle { //get the name of the Bookmarks menu
local (oldtarget = target.set (adrmenu));
local (oldcursor = op.getcursor ());
op.firstsummit ();
menuname = op.getlinetext ();
op.setcursor (oldcursor);
target.set (oldtarget)};
if dialog.ask ("Add this item to the " + menuname + " menu?", adrTitle) {
adrTitle^ = string.replaceAll (adrTitle^, "\"", "\\\"");
adrLogic^ = string.replace (adrLogic^, "<<title>>", adrTitle^);
return (menu.addMenuCommand (adrmenu, menuname, adrTitle^, adrLogic^))}
else {
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.