home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------------------
- // Object Scripting
- // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
- //
- // PRJNOTES.SPP: Project Notes. For new projects, creates a notes text file
- // in the project directory and adds it to the project. The notes file
- // will contain any text found in a template file.
- //
- // USE: Enter any desired template text in prjnotes.dat. Run script and
- // create a new project.
- //
- // FILES: PRJNOTES.DAT, MISC.SPP
- //
- // NOTES: All prjnotes.* files must reside in the same directory.
- //--------------------------------------------------------------------------
- print typeid(module());
-
- //
- // IDE imports.
- //
- import IDE;
- import scriptEngine;
-
- //
- // Load support module(s).
- //
- if (!scriptEngine.IsLoaded("msg")) scriptEngine.Load("msg");
- if (!scriptEngine.IsLoaded("misc")) scriptEngine.Load("misc");
-
- ModuleDir = GetModuleDir(typeid(module())); // Directory of this script.
-
- //
- // Dummy like-named function to cause module load by function invocation.
- //
- prjnotes()
- {
- }
-
- //
- // Adds a prjnotes.txt node.
- //
- AddNotesNode()
- {
- // Instantiate a project node object.
- //
- declare topNode = new ProjectNode();
- declare projNode = new ProjectNode(topNode.Name + ".exe");
-
- // Copy the template file to the project directory as prjnotes.txt.
- //
- declare notesFile = IDE.CurrentDirectory + "\\notes.txt";
- CopyFile(ModuleDir + "\\prjnotes.dat", notesFile, FALSE);
-
- // Add the notes file as a node.
- //
- projNode.Add(notesFile);
- }
-
- //
- // Hook File | New -> Project.
- //
- on IDE:>FileNew(toolName, fileName)
- {
- // Pass to create the new item.
- //
- declare retVal = pass(toolName, fileName);
-
- // Add notes node.
- //
- if (toolName == "Project") {
- AddNotesNode();
- }
-
- // Be sure to return the outcome from down the handler chain.
- //
- return retVal;
- }
-
-