I've been trying to run an AutoIt script file (.au3) from my WPF application. It does not throw any error but does not work.
AutoItX.Run("test.au3", @"C:\Folder\",1);
But it works well with below line.
AutoItX.Run("calc.exe","",1);
C# solution I have :
//switch vpn
Console.WriteLine("Refreshing VPN");
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files (x86)\AutoIt3\AutoIt3.exe";
process.StartInfo.Arguments = " \"" + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "RandomConnectProtonVpn.au3") + "\"";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();// Waits here for the process to exit.
AutoItX does not have the capability of running AutoIt scripts. To do that, you need to use the AutoIt interpreter, e.g. like:
AutoItX.Run(@"""C:\Program Files (x86)\AutoIt3\AutoIt3.exe"" /AutoIt3ExecuteScript test.au3", @"C:\Folder\", 1);
Also see my answer here: how can I call AutoIT UDF within Java