After working to support Dynamics GP Macros in our Visual Studio add in for GP I discovered a new layer of macro language not touched on in Mark Polno’s publication of Kevin Gross’s GP Macro Reference.
How to use macros to activate .NET add in forms
Use the following command:
NewActiveWin dictionary ‘default’ form [customID] window**[.NET form name]**
[customID] seems to be a jumble of characters to uniquely identify this as a addin form.
[.NET form name] is the .NET form name for the form we are trying to show.
NewActiveWin dictionary 'default' form pARthOSt window AuxFormIV00101
Macro commands passed to RecordMacroItem
Any commands sent to the Macro subsystem from the .NET form are wrapped in a wrapper named “ShellCommand”. To record macro commands to the currently recording macro, call the following method on the form derived from Microsoft.Dexterity.Shell.DexUIForm.
'RecordMacroItem(MacroCommandText as string, MacroComment as string)`
The text passed in MacroCommandTextis wrapped in a “ShellCommand” statement in the resulting macro file, as shown here where the highlighted text represents the string passed as the MacroCommandText when the macro was recorded;
ShellCommand 'ClickHit field "btnOK"'
Long Macro Lines
There is another scenario that must be dealt with, the Add in macro equivalent of
ContTypeTo field 'Account Description' , 'nt 1'
This command would continue typing into the field Account Description appending to whatever is already there. The macro system wraps the whole lot in a ShellCommandBegin block, with each line starting ShellCommandAppend. The following is an example of this arrangement:
ShellCommandBegin ShellCommandAppend 'TypeTo field "rebHTMLText", "<ul> <li>HDMI cable with swivel ends - up to 180 De' ShellCommandAppend 'grees </li> <li>Reduces stress on your cables and risk of disconnecting </li> <l' ShellCommandAppend 'i>Provides both high definition video and multi-channel audio connection between' ShellCommandAppend ' digital high definition AV sources such as Blu-ray, DVD players etc. </li> <li>' ShellCommandAppend 'Transfer bandwidth: 10.2Gbps / 340Mhz (v1.3)</li> <li>Signal Type: Transmission ' ShellCommandAppend 'minimised differential signalling (TMDS)</li> <li>Connector Type: Gold plated </' ShellCommandAppend 'li> </ul>"' ShellCommandEnd