19. Print Package and Class Names Script 'The Main statement defines the subroutine where execution begins Sub Main 'Open the Viewport window Viewport.open 'Pass the current open model to the DumpModel subroutine DumpModel RoseApp.CurrentModel 'End the subroutine End Sub
20.
21.
22.
23.
24.
25.
26.
27.
28. The Prefix Script ' Definition of the prefix Const Prefix$ = "Rose98" Sub Main ' Declare local variables Dim theClasses As ClassCollection Dim theClass As Class ' Set the class collection to all the classes in the model Set theClasses = RoseApp.CurrentModel.GetAllClasses ()
29.
30.
31.
32.
33.
34.
35.
Notes de l'éditeur
To open an existing script Select the Tools:Open Script menu command. Click to select the name of the script. Click the Open button. To create a new script Select the Tools:New Script menu command.
To run a script interactively Create a new script or open an existing script. Click the Start button (green triangle). To save a script in compiled form Create a new script or open an existing script. Select the Debugger:Compile menu command. Enter the name of the compiled script. Click the Save button.
Main() is the first procedure to execute no matter where it is located in the script.
This script may be found on your Course Exercise Models disk. It is called “Print Packages and Class Names.ebs”.
A script can be written to change the names of all classes in the model to enforce naming conventions.
This script may be found on your Course Exercise Models disk. It is called “Prefix.ebs”.
This script may be found on your Course Exercise Models disk. It is called “Add Package with One Class.ebs”.
The solution script may be found on your Course Exercise Models disk. It is called “Add Package with Multiple Classes.ebs”.