Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.Frontier.tools.startup
on startup () { <<Changes <<1/18/10; 9:28:44 AM by DW <<Disable the Frontier.tools.thread, install everyMinute script in scheduler2. <<6/13/05; 4:38:32 AM by DW <<Write the custom icons out twice, once at the beginning (as it has always been) and in a second pass at the end, after all the tools are open. The problem came up with the dotOpml.root tool, which has a custom icon for Buddies, but they weren't getting written out because the tool wasn't yet open. <<3/31/02; 3:41:01 AM by JES <<Write out nodeTypes' custom icons within a try block, in case the nodeType no longer exists. Prevents errors at startup after a nodeType has been deleted. <<11/30/01; 5:01:11 PM by JES <<Install Tools in a try statement. <<8/21/01; 12:08:46 AM by JES <<If no Tools are installed, then call system.menus.buildMenuBar so that the Tools menu will appear in the menu bar, regardless of wheteher there are any Tools installed. <<7/12/01; 3:45:38 AM by JES <<When writing out custom icons, dive into addresses of nodeType tables. <<2/13/01; 2:17:54 PM by PBS <<Don't install Tools such as Music.root, StaticSites.root, etc. <<2/12/01; 12:13:40 PM by PBS <<Check if Music.root exists in the Tools folder before attempting to build the Player app sub-menu. This prevents a scriptError during startup if you don't have or have moved Music.root. <<01/06/01; 7:03:27 PM by PBS <<Install every Tool that is enabled. Uninstall every Tool that is disabled. bundle { //thread changes, 1/18/10 by DW Frontier.tools.thread.enabled = false; if defined (user.scheduler.threads.tools) { delete (@user.scheduler.threads.tools)}; if not defined (user.scheduler2.everyMinute.frontierTools) { user.scheduler2.everyMinute.frontierTools = @Frontier.tools.everyMinute}}; on writeCustomIcons () { <<Custom icons are written to the [program folder]/Appearance/Icons/ directory. <<04/18/2001 JES: cribbed from startup.startupScript in Radio local (appFolder = file.folderFromPath (Frontier.getProgramPath ())); local (pc = file.getPathChar ()); local (iconsFolder = appFolder + "Appearance" + pc + "Icons" + pc); file.sureFilePath (iconsFolder); //make sure path to folder exists file.sureFolder (iconsFolder); //make sure the folder exists local (adrTable); local (platform = "windows"); if system.environment.isMac { platform = "mac"}; local (adrItem); for adrItem in @Frontier.tools.data.nodeTypes { try { //don't fail when a nodeType no longer exists while typeOf (adrItem^) == addressType { adrItem = adrItem^}; if defined (adrItem^.icon) { local (adrIcon = @adrItem^.icon.[platform]); if defined (adrIcon^) { local (itemName = nameOf (adrItem^)); local (fname = itemName); if system.environment.isWindows { fname = fname + ".bmp"}; local (f = iconsFolder + fname); if not (file.exists (f)) { //write only if file does not exist if system.environment.isWindows { file.writeWholeFile (f, adrIcon^)}; if system.environment.isMac { //write to resource fork file.writeWholeFile (f, "", 'rsrc', 'RSED'); //type is resource, creator is ResEdit local (adrResource); for adrResource in adrIcon { //write each resource rez.putResource (f, getBinaryType (adrResource^), 128, adrResource)}}}}}}}}; Frontier.tools.init (); //11/28/00 JES writeCustomIcons (); try { //11/28/00 JES: lock a semaphore to prevent race conditions semaphore.lock (this, 7200)} else { semaphore.unlock (this)}; if system.environment.isPike { Frontier.tools.menu = Frontier.tools.data.virginRadioToolsMenu} else { Frontier.tools.menu = Frontier.tools.data.virginToolsMenu}; local (toolsFolder = Frontier.tools.getToolsFolderPath ()); local (f, flRebuildMenuBar = true); fileloop (f in toolsFolder) { //install new and changed tools local (fname = file.fileFromPath (f)); if string.lower (fname) endsWith ".root" { try { Frontier.tools.uninstall (f); if Frontier.tools.isEnabled (f) { Frontier.tools.install (f); //now install it flRebuildMenuBar = false}}}}; bundle { //uninstall removed tools local (adrDatabase); for adrDatabase in @user.tools.databases { local (flUninstall = false); if not (file.exists (adrDatabase^.path)) { flUninstall = true}; if string.lower (file.folderFromPath (adrDatabase^.path)) != string.lower (toolsFolder) { flUninstall = true}; if flUninstall { Frontier.tools.uninstall (adrDatabase^.path)}}}; bundle { //special case for Music tool -- build Player submenu if file.exists (toolsFolder + "Music.root") { //PBS 02/12/01: skip if the Music Tool doesn't exist if Frontier.tools.isEnabled (toolsFolder + "Music.root") { MusicSuite.buildPlayerSubmenu ()}}}; semaphore.unlock (this); //11/28/00 JES if flRebuildMenuBar { //08/21/01 JES: make sure the Tools menu is installed. system.menus.buildMenuBar ()}; writeCustomIcons (); //6/13/05; 4:43:13 AM by DW return (true)}; bundle { //testing startup ()}
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.