Automation Anywhere A2019 allows you to call external scripts and programs. The scripting languages support Python / Javascript / VBScript, which can be prepared as separate files or embedded in the bot as an inline script and executed. If you want to keep it as a separate file, you will have to upload the locally created file to the Control Room in advance. In either case, the script will be executed in the environment of the local PC.
Python
Inlinescript
from tkinter import messagebox
messagebox.showinfo('Python', 'Hello World')
Note: To execute Python code, you need to build a Python execution environment on your local PC. For more information, see @ zamaezaaa's article "Running Python code on A2019 Community Edition" (https://qiita.com/zamaezaaa/items/b956243ce80f9a652dfb). If you run the bot in an environment without a Python execution environment, the bot will not execute anything and will end normally, but the bot Agent may freeze and the next bot may not be able to run, requiring a reboot. ..
Execution result
Reference information
Javascript
Inlinescript
function getRandom() {
return Math.floor( Math.random()*10000 );
}
This is a function that returns a random number between 0 and 10,000.
Find ** "JavaScript: Run JavaScript" ** and drag and drop it at the end of the flow, and in the action details, getRandom
for the function name to be executed and$ prompt-assignment $
for the output storage location. Specify the variable.
Finally, find ** "JavaScript: Close" **, drag and drop it at the end of the flow, insert a MessageBox action after it, and set it to display the $ prompt-assignment $
variable. Save it and you're done.
Execution result
Note: For JavaScript, screen output implemented by browsers such as ʻalert
,
prompt,
writeln, and WSH objects such as
WScript.Echo,
WScript.StdOut.WriteLine`. Since an error occurred when using, I executed only the value processing with JavaScript and displayed the result in the MessageBox of Automation Anywhere.
Reference information
VBScript
Inlinescript
MsgBox "Hello World"
Execution result
Reference information
[^ 1]: The content of the product documentation is updated frequently, so it is recommended to refer to the English version of the documentation.
[^ 2]: Looking at the latest English documentation, in Python you can pass only one argument to the function (Boolean, dictionary, list, number, string), in JavaScript / VBScript you can pass a list type variable It says that you can pass multiple arguments (Boolean, Datetime, number, string etc.). However, in A2019.10 (build 2545), in VBScript, you can enter character strings and numbers in addition to list type variables in "Arguments to the function" in the action details.
Recommended Posts