Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.table.newSuite
on newSuite (adrSuite) { <<Creates a new suite of scripts in Frontier's database <<and then creates a sub-table in the suites table <<it creates: <<a starter menu <<an installMenu script <<an empty readMe text window <<thanks to: <<Peter Dako, for writing the 1st version of this script <<8/31/99; 12:19:36 PM by DW <<Call system.menus.buildSuitesSubmenu when we're finished to update the Suites sub-menu of the Main menu. local (suiteName = nameOf (adrSuite^)); local (prettySuiteName = string.upper (suiteName [1]) + string.mid (suiteName, 2, sizeof (suiteName))); new (tableType, adrSuite); adrSuite^.suiteName = prettySuiteName; bundle { //build the menubar local (adrMenubar = @adrSuite^.menu); new (menubarType, adrMenubar); target.set (adrMenubar); op.setLineText (prettySuiteName); on addCommand (name, script) { menu.addMenuCommand (adrMenubar, prettySuiteName, name, script)}; addCommand ("Read Me", "edit (@" + suiteName + ".readMe)"); addCommand ("-", ""); addCommand ("Edit Menu", "edit (@" + suiteName + ".menu)"); addCommand ("Edit Table", "edit (@" + suiteName + ")"); bundle { <<work around an apparent bug in the Windows version, 11/3/97 DW op.firstSummit (); if op.getLineText () == "" { op.deleteLine ()}}; target.clear ()}; bundle { //build the readme local (adrReadMe = @adrSuite^.readMe); new (wptextType, adrReadMe); target.set (adrReadMe); wp.insert ("This is the " + suiteName + " suite." + cr + cr); with user.prefs { wp.insert ("Created by " + name + " of " + organization + " on " + string.dateString () + " at " + string.timeString () + "." + cr + cr)}; wp.insert ("[Why I Wrote It]" + cr + cr); wp.insert ("[What It Does]" + cr + cr); wp.insert ("[Things To Watch Out For]" + cr + cr); window.zoom (adrReadMe); target.clear ()}; <<bundle //build the installMenu script <<local (adrInstallMenuScript = @adrSuite^.installMenu) <<new (scriptType, adrInstallMenuScript) <<target.set (adrInstallMenuScript) <<op.setLineText ("return (menu.install (@" + suiteName + ".menu))") <<target.clear () bundle { //build the init script local (adrInitScript = @adrSuite^.init); new (scriptType, adrInitScript); target.set (adrInitScript); op.setLineText ("if not defined (user." + suitename + ")"); op.insert ("new (tableType, @user." + suitename + ")", right); target.clear ()}; <<menu.importSuite (adrSuite, prettySuiteName) //add a command to the Suites menu <<menu.addSuite (adrSuite) <<it appears in the menubar now system.menus.buildSuitesSubmenu (); //add DG to Suites sub-menu of the Main menu return (true)} <<bundle //test code <<newSuite (@suites.blagooey) <<edit (@suites.blagooey)
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.