# Libraries

Standard Libraries In addition to the Standard Routines, which are implicitly available in all scripts, the Scripting Module provides access to several libraries of code, variables, and constants:
Library | Description
System |
Graphics | The Graphics library is the main provided to allow access to the color constants. See Graphics Color Constants for a full list of these.
FFConstants | Contains constants used throughout scripts.
FFErrors | Contains constants and routines for displaying network calculation errors.
FFKindConstants | Contains constants for all the different element kinds available in FluidFlow.
Note: The FFConstants, FFErrors, and FFKindConstants libraries are located in the "[FluidFlow3 folder]\Default\Scripts" folder, and will be continually added to. You should not modify any of these files and they will be updated by new releases of FluidFlow. To access the routines and constants in these libraries you must explicitly specify the name of the library in a uses clause. Example: uses Graphics, // Include this to get access to clRed and ColorToString. FFKindConstants; // Required for Element Kind constants. var NodeIds; begin s := ColorToString(clRed); ShowMessage(s); // Use the ekBoundaries constant to fill NodeIds with all the // Boundaries in the network. Count := Network.GetNodes(NodeIds, ekBoundaries); ShowMessage('No. Of Boundaries = ' + IntToStr(Count)); end; User-Defined Libraries You can also create your own libraries of commonly used routines. These libraries should be stored in your "\Preferences\[Username]\Scripts" folder, and must be named with the PSC extension. As with the Standard Libraries, you must explicitly include the name of the library in your script's uses clause. To create a library, create a new Flowsheet and use the Scripting window to enter your library code. Select the File | Save To File... menu item and save the file to your '\Preferences\[Username]\Scripts" folder, ensuring that you name the file with a .PSC extension. Example Library: // MyLibrary.psc const mlOne = 1; mlTwo = 2; mlThree = 3; procedure TestMyLibrary(Msg: Integer); begin case Msg of mlOne: ShowMessage('One'); mlTwo: ShowMessage('Two'); mlThree: ShowMessage('Three'); else ShowMessage('Unknown'); end; end; Example Usage: uses MyLibrary; begin TestMyLibrary(mlThree); end;