CmcScriptNet.WPF is a stand-alone, open-source script editor for Commence Item Detail Form scripts. It does not require installation. It replaces CmcScriptNet, which was a Winforms application.
Another editor?
Yes. The best Commence script editor historically is ScriptPad by Matthias Claes. Huge kudos to him! Due to changes in Commence, ScriptPad cannot be used for Commence versions higher than RM 4.1. That sucks! So I decided to create my own, modeled after ScriptPad.
Memocom has developed MemoEdit for script editing. It is available free of charge to all Memocom customers, but it is a closed-source, commercial product.
Additionally, MemoEdit has a few drawbacks that prompted me to write my own editor:
MemoEdit requires installation. I don't like that. I just want a stand-alone editor without hassles. Like ScriptPad was.
MemoEdit keeps a reference to Commence open while running. That means that if you close Commence while MemoEdit is still running, the commence.exe process is not actually closed until you exit MemoEdit. This is unwanted in some scenarios.
MemoEdit has some nice features, such as pre-fab code-samples, but these are closely tied to other proprietary Memocom tools. You may not have them, and I am not a fan of this type of tight coupling.
CmcScriptNet.WPF only talks to Commence when needed. It also should leave no trace, no temp files, nothing.
Unique features
Shows a list of all controls on the form, with some additional information (see the tooltip!). This means you don't have to go back into the Commence form editor to identify what control is what (like whether a textbox is bound to a datafield or not).
Includes a navigation bar to quickly jump to sections of your code.
Inserts a Field/Connection/Control at the the click of a button.
Includes a Filter Builder tool that mimics the filter dialog in Commence. (added 2019-05-14)
(Experimental) Allows saving of script and then immediately show a form. (added 2020-07-01). Note: This is an experimental feature that by design cannot work reliably in all cases because of factors beyond my control (such as auto-closing scripts, errors with images, filtered detail forms, duplicate names, etc.). If it works, it is nice, otherwise you're just of of luck.
Maturity and stability
CmcScriptNet.WPF is in beta and will probably be until the end of times. I developed it primarily for personal use.
(The old WinForms version is still available here)
Note that this is an executable file, so browsers may complain about security when downloading. Additionally, the file will likely be flagged as 'blocked' once downloaded. Simply unblock it via File Properties or learn to live with the 'Unknown Publisher' prompt when executing. This is expected behaviour.
CmcScriptNet.WPF uses Scintilla as its editor component. Scintilla is a widely used editor component used in many products, notably Notepad++ and SciTe. I chose it because it is really simple to embed yet quite powerful. It is not a native .Net control however. In the future I may replace it by a more fancy control like AvalonEdit, but I do not have active plans to do so at the moment.
All components used by CmcScriptNet.WPF are compiled into the assembly itself, resulting in a single, stand-alone executable.
Compiling these into a single assembly was done using Costura.
Documentation
This page is it. I hope you weren't expecting more :)
Limitations and known issues
Making a document float will likely crash the application.
The first time you run the application it may take a few seconds to start because of unpacking in the background.
You can 'save' a script to a database even if you don't have Author permission. The script won't actually be saved in that case, but no error is thrown. This is a limitation of Commence, not CmcScriptNet.
Code folding is provided by Scintilla. When dealing with VBScript I believe it relies on proper indentation.
Limitations of Scintilla apply.
If you change databases while working on a script, or close Commence, or open another instance, or all of the above, CmcScriptNet.WPF should complain in an intelligible way. It's a pretty complex business in the end, so let me know if it fails and please provide a repeatable scenario if it does. Remember that simply restarting CmcScriptNet.WPF is always an option.
The GoTo list is generated by a rather crude parser. It produces unexpected results if your script contains classes. Typically few do. I may refine it, but it does an okay job in 99% of cases which is good enough for me.