【问题标题】:Run AutoIT script file (.au3) from C#从 C# 运行 AutoIT 脚本文件 (.au3)
【发布时间】:2017-01-19 05:45:24
【问题描述】:

我一直在尝试从我的 WPF 应用程序运行 AutoIT 脚本文件 (.au3)。 但无法运行脚本文件。它不会抛出任何错误但不起作用。这就是我所做的。

AutoItX.Run("test.au3", @"C:\Folder\",1);

但它适用于下面的行。

AutoItX.Run("calc.exe","",1);

【问题讨论】:

    标签: wpf autoit


    【解决方案1】:

    我知道这已经三岁了,但我正在寻找与线程启动器相同的答案。这是我到的 C# 解决方案;

                    //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.
    

    希望这对将来的某人有所帮助。

    【讨论】:

      【解决方案2】:

      AutoItX 不具备运行 AutoIt 脚本的能力。为此,您需要使用 AutoIt 解释器,例如喜欢:

      AutoItX.Run(@"""C:\Program Files (x86)\AutoIt3\AutoIt3.exe"" /AutoIt3ExecuteScript test.au3", @"C:\Folder\", 1);
      

      也可以在这里查看我的答案:how can I call AutoIT UDF within Java

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-13
        • 2011-10-01
        • 1970-01-01
        • 2017-05-07
        • 2013-06-03
        • 2011-02-23
        • 1970-01-01
        相关资源
        最近更新 更多