Part of the Samples Website. 8/16/97.

samples.basicStuff.createNewSuite

«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
on newSuite (adrSuite)
local (suiteName = nameOf (adrSuite^))
new (tableType, adrSuite)
local (adrMenubar = @adrSuite^.menu)
new (menubarType, adrMenubar)
target.set (adrMenubar)
op.setLineText (suiteName)
target.clear ()
on addCommand (name, script)
menu.addMenuCommand (adrMenubar, suiteName, name, script)
addCommand ("Read Me", "edit (\@" + suiteName + ".readMe)")
addCommand ("-", "")
addCommand ("Edit Menu", "edit (\@" + suiteName + ".menu)")
addCommand ("Edit Table", "edit (\@" + suiteName + ")")
local (adrReadMe = @adrSuite^.readMe)
new (wptextType, adrReadMe)
target.set (adrReadMe)
wp.insert ("This is the " + suiteName + " suite." + cr + cr)
wp.insert ("Created by " + user.name + " of " + user.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 ()
local (adrInstallMenuScript = @adrSuite^.installMenu)
new (scriptType, adrInstallMenuScript)
target.set (adrInstallMenuScript)
op.setLineText ("on installMenu ()")
op.insert ("return (menu.install (\@" + suiteName + ".menu))", right)
target.clear ()
local (adrImportSuiteScript = @adrSuite^.importSuite)
new (scriptType, adrImportSuiteScript)
target.set (adrImportSuiteScript)
op.setLineText ("on importSuite (adr)")
op.insert ("return (menu.importSuite (adr, \"" + suiteName + ""))", right)
target.clear ()
adrSuite^.importSuite (adrSuite) «tricky, we call the script we just created!
menu.addSuite (adrSuite) «add it to the menubar
return (true)
if dialog.ask ("Name of new suite:", @scratchpad.lastSuiteName)
local (adrSuite = @suites.[scratchpad.lastSuiteName])
if defined (adrSuite^)
if not dialog.confirm ("Replace existing suite named "" + scratchpad.lastSuiteName + ""?")
return (false)
newSuite (adrSuite)
edit (adrSuite)


This page was last built on Sat, Aug 16, 1997 at 6:34:26 PM. You can download the current set of sample scripts from our FTP site. Dave