Anybody know how to automate Mach3 R3.043.066 from C# VS2013?
Code below compiles fine then gives: "An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll"
The application was built for X86 and both Mach3 and the app are running as admin. Also, I reinstalled Mach3.
Thanks in advance.
using System.Runtime.InteropServices;
namespace AutomationTest
{
public partial class Form1 : Form
{
private Mach4.IMach4 Mach = null;
private Mach4.IMyScriptObject Script = null;
private void button1_Click(object sender, EventArgs e)
{
Mach = (Mach4.IMach4)Marshal.GetActiveObject("Mach4.Document"); <<<== ERROR HERE
Script = (Mach4.IMyScriptObject)Mach.GetScriptDispatch();
Script.Code("G1 X2 Y2 F400");