【问题标题】:RUN Bat files with AutoIt Number运行带有 AutoIt 编号的 Bat 文件
【发布时间】:2017-04-06 09:16:21
【问题描述】:

我想运行 AutoIt 应用程序,更改编辑框中的数字,然后根据这个数字运行 BAT 文件。

例如,我想更改今天的日期或其他日期。基于当我从 AutoIt 应用程序运行 BAT 文件时,BAT 文件将使用此日期。

真的可以吗???

这是bat文件变量:

set newDay=22
set newMonth=11
set newYear=2016

这是 AutoIt 的一部分:

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $xxx
            Run("n:\xxx\xxx\xxx.bat")
    EndSelect
WEnd

【问题讨论】:

  • 您需要指定批处理文件应如何接收数字——通过命令行参数、标准输入流等......

标签: batch-file cmd autoit


【解决方案1】:

从 autoit 代码中传递:

   While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $xxx
                Run("n:\xxx\xxx\xxx.bat" & " " & $newDay & " " & $newMonth  & " " & $newYear)
        EndSelect
    WEnd

并被批处理文件接收:

set newDay=%1
set newMonth=%2
set newYear=%3

【讨论】:

  • $newDay = GUICtrlCreateEdit("99", 176, 32, 121, 97) |运行("n:\xxx\xx\xx.bat" & " " & $newDay)。 |设置新日=%1 |这行不通。不知道为什么。
  • 那是因为你需要使用 GUICtrlRead() 来获取编辑框中的值。或者,使用 InputBox() 对您来说可能更简单
猜你喜欢
  • 2014-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-26
相关资源
最近更新 更多