0

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);

3 Answers 3

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.
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

0

I solved it by compiling the script into an .exe (right click and compile with options and then choose .exe and compile.

  1. using System.Diagnostics;
  2. Process.Start("path");

Example:

Process.Start("C:\\Users\\YourUserName\\Downloads\\hello.exe");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.