将命令行 arguments/parameters 传递给 AutoIt 可执行文件

Passing command-line arguments/parameters to AutoIt executables

我的 AutoIt 脚本:

WinWaitActive("User Authentication","","10")

If WinExists("User Authentication") Then

   ; Enter a username.
   Send("prabu{TAB}")
   Send("{TAB}")

   ;Enter a Password.
   Send("Password")
   Send("{TAB}")
   Send("{SPACE}")

   ;Press Authenticate button.
   Send("{TAB} {ENTER}")

EndIf

我"compiled"它到一个.exe文件并从Selenium执行它使用:

Runtime.getRuntime().exec("C:\Users\Prabu\Documents\ds.exe");

但我希望它每次都输入不同的用户名和密码。我打算使用命令行参数(如果您愿意,可以使用参数)将这些提供给脚本。

是否可以将 arguments/parameters 传递给 AutoIt 脚本?如果是这样,应该如何完成以及如何访问提供给我脚本的 arguments/parameters?

AutoIt 脚本的变化

$username = $CmdLIne[1]
$password=$CmdLine[2]
Send($username)
Send($password)

在 java

String command="C:\Users\Prabu\Documents\ds.exe \"username1\" \"password1\"";      
Runtime.getRuntime().exec(command);

参考

https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine http://seleniumocean.blogspot.in/2014/11/its-time-for-autoit-parameterizing.html