【问题标题】:Running Autoit script from Excel VBA从 Excel VBA 运行 Autoit 脚本
【发布时间】:2023-03-13 12:17:02
【问题描述】:

我正在尝试通过单击按钮从 excel vba 运行 autoitscript。

我想从 Excel 工作表运行 notepad1.au3 脚本。

我将脚本复制到与 Excel 工作表相同的目录中。

我编写了以下 vba 代码来运行脚本。一切似乎都运行良好,它准确地获取了路径文件名等。

但不是只运行脚本,而是弹出一个资源管理器窗口,要求我找到要运行的脚本。

我可以通过资源管理器窗口浏览到脚本所在的位置,然后选择脚本文件,它就会运行。

但我希望它在不打开资源管理器窗口的情况下运行。

知道问题出在哪里吗?

谢谢

VBA 代码:

Sub Autoit()

Dim AutoItPath
Dim FileName As String
Dim FileName1 As String
FileName = ThisWorkbook.Path & "\notepad1.au3"
MsgBox (FileName)
AutoItPath = "C:\Program Files (x86)\AutoIt3" & "\AutoIt3.exe "
MsgBox (AutoItPath)
FileName1 = """" & AutoItPath & """" & """" & FileName & """"
MsgBox (FileName1)
runscript = Shell(FileName1)
End Sub

【问题讨论】:

    标签: excel vba autoit


    【解决方案1】:

    你的电话打错了。查看帮助文件:

    使用解释器运行脚本:

    AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] 文件名 [params ...]

    使用可选参数执行 AutoIt3 脚本“文件名”

    示例命令:"'" & "C:\Program Files (x86)\AutoIt3\AutoIt3.exe " /AutoIt3ExecuteScript "..path\notepad1.au3" & "'"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-15
      • 2011-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多