Scripts are Manifold programs written in an ActiveX or .NET programming language that is installed on the computer system.


Visual Basic Scripting Edition is the default ActiveX scripting language used with Manifold; however, JScript (Microsoft's implementation of Javascript) is also frequently used. Scripts may be written in any language for which an ActiveX scripting engine is available. Some users, for example, prefer to write scripts in Python or Perl using ActiveX scripting engines for those languages that are available from third party suppliers.


Documentation and technical support for scripting in Manifold uses VBScript with occasional examples in JScript. The use of other languages is respected but is not covered by documentation or technical support. VBScript and JScript are covered since these are standard Microsoft languages that may be redistributed by with Manifold.


Manifold also supports scripting in Microsoft .NET languages such as C#, JScript .NET, IronPython .NET and VB .NET.


Scripts are components that appear in the project pane.


·      To create a script, choose File - Create - Script or using the Create button in the project pane toolbar, choose Script.

·      Double click a script component to edit it in a script window. Specify the language to be used with Scripts - Language.

·      Highlight a script in the project pane and press the Run button to execute it.


When a script window is open, the Script menu is available:


Open Form

Open the form associated with this script.

Open Table

Open the table associated with this script.


Run the script

Run under Debugger

Run a script under control of the debugger. Available if the Debugger is installed.


Pause execution of a script. Available if the Debugger is installed.


Stop execution of a script. Available if the Debugger is installed.

Step Into

Step over a routine. Available if the Debugger is installed.

Step Out

Step into a routine. Available if the Debugger is installed.

Step Over

Step out of a routine. Available if the Debugger is installed.


Specify a scripting language. Available choices will include all supported ActiveX scripting engines installed on the computer system as well as all supported .NET scripting languages.


View and modify script references. Available for .NET scripts.

Compile to DLL

Compile a script into a DLL. Available for .NET scripts.


Note: In the above comments, "Available if the Debugger is installed" means the capability is available if an ActiveX language is being used and the necessary Microsoft facilities to enable the Manifold debugger have been installed. See the Debugger topic.


Use keyboard shortcuts to set and clear breakpoints. Click on a text line in the script window and then press F9 to toggle a breakpoint at that line.




Choose File - Create - Script to create a new script component in the project pane.




The Create Script dialog box will allow us to name our new script, provide an optional description and choose a language (default choices being C#, JScript, JScript .NET, VB .NET and VBScript). If a .NET language is selected, we can check the Add references for standard .NET modules box. Regardless of whether or not you check this box, you can always add new references or remove existing references using the Script - References command.


images\icon_script.gif The new script component will appear in the project pane marked with a script icon. Clicking on the component to highlight it will provide information about script in the project pane status bar, including the size of the script and the language used.


Double-click the script component to open it in a script window. The new script will appear with startup text appropriate for that language, by default showing a simple script to print "Hello, World!" to a message box.


Running a Script


Creating a new script automatically loads it with code for the language of choice to display the classic "Hello, World!" message in a message box. This helps us get started by providing a framework and is extremely useful when writing applications that say "Hello."


Suppose we have created a VB .NET script. The default text in the script will be:




Note that the above script uses the built-in Application object.


images\btn_run_script.gif Press the Run button in the Tools toolbar to run the script. We can also click onto the script component in the project pane to highlight it and then press the Run button in the project pane.




A message box appears with our desired message. Press OK to close the message box.


If we had used a .NET language like VB .NET, whenever we run the script it will first be compiled, which may add a delay before the script launches in the case of large scripts. We can avoid this delay by using the Script - Compile to DLL command to compile the script into a DLL.


Any errors detected during compilation of a .NET script will be displayed in the Errors pane.


Note: If we are working in an ActiveX language and the Debugger has been configured we can run scripts using the Debugger. See the Debugger topic for more information.


Command Line Script Startup


The /autoexec:<scriptname> command line switch allows running a script after opening the MAP file specified in the same command line. For example, the following command line will open the project file and then run the myscript script found in that project file.


 manifld.exe /autoexec:myscript c:\MyProjects\


Saying Hello in C#


The C# version of "Hello, World" is:




Saying Hello in JScript


The JScript version of "Hello, World" is:




Saying Hello in JScript .NET


The JScript .NET version of "Hello, World" is:




Saying Hello in VB .NET


The VB .NET version of "Hello, World" is:




Saying Hello in VBScript


The VBScript version of "Hello, World" is:




Saying Hello in IronPython


IronPython is the fine .NET language created by Jim Hugunin and supported by Microsoft. It has emerged as the Python of choice for Microsoft .NET and is supported by Manifold Technical Support for developer level support incident questions.




The above example consists of four lines of code, the third line of which is blank. Whitespace is significant in Python so it is important that the third line remain blank for the example to function.


IronPython scripts intended to be used for active columns should only include the body for a single script function.


Creating a script in IronPython automatically adds references to the IronPython assemblies. To work correctly in all cases, the IronPython assemblies should be installed in the Global Assembly Cache. The Global Assembly Cache (GAC) is a central place for .NET assemblies on a machine. Putting an assembly into the GAC makes it possible for all .NET applications to locate and use that assembly.

To put IronPython assemblies into the GAC, open the Command Prompt as a user with administrative privileges (use Run As Administrator in Windows Vista), navigate to the IronPython folder, and run the following commands:

gacutil -i ironpython.dll
gacutil -i ironmath.dll

The above requires installation of the .NET SDK (which contains the GACUTIL program). The .NET SDK is easily found and downloaded from the Microsoft web site.


Thanks go out to Jim Hugunin for creating IronPython (excellent name!) and also to Microsoft for supporting IronPython. Well done!


Saying Hello in PythonScript and PerlScript


Many languages are available as ActiveX scripting languages for Windows. For example, installing the Active State Python or Perl distributions (free as of this writing from will add Python and Perl scripting capabilities to Manifold. As with JScript, scripts in these languages use the built-in Application object.




def Main():

 Application.MessageBox("Hello, World!")




sub Main {

 $Application->MessageBox("Hello, World!");



Some users prefer scripting in Python or Perl to scripting in VBScript or JScript; however, Manifold technical support is able to support only VBScript, JScript and the .NET languages.


Adding Scripts as Toolbar Buttons or Menu Commands


Scripts (which may call external COM objects) may be added as custom toolbar buttons or menu items. See the Add-Ins topic for information on adding new toolbar buttons or menu commands.


Script Window Keyboard Shortcuts


Script windows support well-known Windows keyboard shortcuts, including those often used in Windows programming editors:



Select All


Cut selected text and copy to the Clipboard.


Copy selected text to the Clipboard.


Paste text contents of the Clipboard.


Delete current line.


Comment out selected text.


Uncomment selected text.


Convert selected text to lower case.


Convert selected text to upper case.


Equivalent to CTRL-C. An old Windows shortcut kept for compatibility.


Equivalent to CTRL-V. An old Windows shortcut kept for compatibility.


Multi-level Undo.


Multi-level Redo.


Check the character near the cursor and, if it is a bracket character, jump to the matching bracket.


Check the character near the cursor and, if it is a bracket character select the text between the bracket and the matching bracket.


Same as CTRL-X or Cut.


Same as CTRL-Z or multi-level Undo.


CTRL-K and SHIFT-CTRL-K comment / uncomment commands will automatically switch between commenting styles based on the language specified for the script window with the Script - Language command. Works for C#, JScript, JScript .NET, PERL, Python, VBScript and VB .NET.


Recognized bracket combinations for use with Ctrl-] and Ctrl-Shift-] are ( and ), [ and ], { and }, ' and ', " and " and # and # (used to delimit dates in queries).


Example: Referencing a Script that has been Compiled into a DLL


The Script - Compile to DLL command may be used with .NET languages to avoid the slight compile delay when the .NET script is compiled before running. The command may also be used to compile .NET language scripts into DLLs for future use in other scripts, as in the following example:


1. Launch Manifold. Create a new project.


2. Create a new script using VB .NET. Enter the following script text:


Imports Manifold.Interop


Public Class Test

Public Shared Function ComponentCount(D As Document) As String

Return D.ComponentSet.Count

End Function

End Class


3. Choose Script - Compile to DLL and save the DLL into the Manifold installation folder (that is, the Windows folder into which Manifold System itself was installed, by default, C:\Program Files\Manifold System).


4. Create another script using VB .NET. Invoke Script - References. Click New, and select the compiled DLL created in the above steps. Enter the following script text:


Imports Manifold.Interop.Scripts


Class Script

Shared Sub Main

Context.Application.MessageBox( _

Test.ComponentCount( _

Context.Application.ActiveDocument), "Script")

End Sub

End Class


Invoke Script - Run. The script will show the number of components in the currently opened MAP file.


It is, of course, possible to place a compiled DLL into a folder that is different from the Manifold installation folder, but then we would have to make sure the .NET loader will be able to find both:


a) the compiled DLL when running a Manifold script that refers to it (usually achieved by either signing the compiled DLL and putting it into the global assembly cache, or by putting the compiled DLL into a folder mentioned in the PATH environment variable), and


b) all Manifold DLLs required when loading the compiled DLL (usually achieved by using a custom configuration file).


Running a .NET script first searches for referenced assemblies that use relative paths in the Manifold installation folder and then searches in the Configuration folder set in Tools - Options in File Locations.


See Microsoft documentation on .NET languages for details, including MSDN. In particular see this MSDN topic (URL current as of the time of writing) for more information:




Attempting to save or close a project in the middle of an executing script will display a warning message. Stop any executing scripts before saving or closing a project.


Script windows support multi-level Undo / Redo. One can CTRL-Z (Undo) backwards through many changes and CTRL-Y (Redo) forwards to redo many Undo operations.


Script windows will show their contents using different colored font for different parts of the script. This is called syntax highlighting and is a helpful way of identifying typographical errors. Fonts used in script windows may be specified in Tools - Options. However, fonts used with script windows will be restricted to fixed-width fonts.


See Also



Script Examples


Programming Manifold

Scripting Reference


See the Active Columns topic for a cool use of scripts within tables. See Active Columns using VBScript and Active Columns using JScript for examples using active columns and script functions written in VBScript and JScript.


See the Forms and Scripts topic for examples of using scripts together with forms.


See the Debugger topic if you are working with ActiveX languages and interrested in using the Debugger.