Since CM4D does not have any debugging tools built in, you may develop and debug the scripts in another application, such as Visual Studio or Excel, before migrating it into CM4D.
If you develop scripts in an external application, you must have a CM4D API license.
Microsoft Visual Studio not only gives you convenient tools for writing code, such as IntelliSense, but it also provides debugging capabilities that are not available in the current CM4D scripting engine.
To create internal scripts using Visual Studio:
1. Open Visual Studio and create a C# Console Application.
2. Add references for the CM4D COM Component and for the CM4D.Scripting .NET Assemby.
The CM4D.tlb and CM4D.Scripting.dll files can be found in the CM4D installation folder (default location: C:\Program Files\Applied Tech Systems\CM4D).
3. Add a class called CM4DScript.
4. Set up the CM4DScript class. Make sure to add the using statement.
5. Create the Execute function, matching what you see in the CM4D Scripting.
6. Configure Main. Make sure to add the using statement.
a. Initialize QaDoc.
b. Create CM4DScriptingDoc and initialize it by setting up the Doc property.
c. Create a new CM4DScript.
d. Call execute and test out your script.
7. When you are satisfied, copy the code to CM4D's internal scripting dialog.
8. Run it in CM4D.
For coding examples, see the topic Scripting Examples.