Aa Writinginlinescriptsinautomation360 Steplist
Aa Writinginlinescriptsinautomation360 Steplist
Aa Writinginlinescriptsinautomation360 Steplist
Introduction
This demo will help you to invoke a JavaScript, VBScript, and Python code snippets in Automation
360.
Prerequisites
You need access to the Automation 360 Control Room.
1. Invoking a JavaScript code to generate voucher numbers and store them in a
Microsoft Excel worksheet along with an issue date and an expiry date for each
number.
a. Log in to the Automation 360 Control Room.
b. Create a bot.
i. In the Getting started section of the Dashboard, click Create a bot.
ii. Enter a name for the bot and then click Create & edit.
c. Open the JavaScript by manually entering the JavaScript.
i. From the Actions palette, drag and drop the JavaScript: Open action into the bot
editor.
ii. In the Action details pane, select the Manual input and enter the code in the Enter
script here field.
d. Invoke the JavaScript.
i. From the Actions palette, drag and drop the JavaScript: Run JavaScript action below
the JavaScript: Open action.
ii. In the Action details pane, specify the name of the function and assign the output to a
variable.
e. Close the JavaScript.
i. From the Actions palette, drag and drop the JavaScript: Close action at the end.
f. Display the JavaScript output value stored in the variable.
i. From the Actions palette, drag and drop the Message box action into the bot editor.
ii. In the Action details pane, click Insert variable icon in the Enter the message to display
field and then, select the variable that stores the return value from the JavaScript
function.
g. Click Save.
h. Click Run.
i. Once the bot has run successfully, a random number is generated.
j. Click Close to close the message box.
k. Click Close to close the bot successful popup.
l. Next, open the Excel workbook to store the voucher code details using Excel Advanced:
Open action.
m. Add a loop action to run 10 times.
n. Move the JavaScript actions Inside the loop.
o. Below the JavaScript: Close action, add the Number: To string action to convert a numeric
counter variable value to string.
p. Use the Excel Advanced, Go to cell and Set cell actions to store this value into the respective
cell.
q. Use the Datetime: To string to convert the system date into a string and store this in a string
variable.
r. Use the Excel Advanced, Go to cell and Set cell actions to store this value into the respective
cell.
s. Use the Datetime: Add to add 90 days to the system date and store this value as a string
using the Datetime: Add and Datetime: To string actions, respectively.
t. Use the Excel Advanced, Go to cell and Set cell actions to store this value into the respective
cell.
u. Increment the value of the numeric counter variable by 1.
v. Close the Excel workbook.
1
w. Click Save and run the bot.
Congratulations! You have now successfully invoked a JavaScript code in a bot. The bot generates 10
random numbers and stores them in a Microsoft Excel worksheet along with an issue date and an
expiry date for each number.
2. Invoking a VBScript code to display the username along with the system date and
time.
a. Log in to the Automation 360 Control Room.
b. Create a bot.
i. In the Getting started section of the Dashboard, click Create a bot.
ii. Enter a name for the bot and then click Create & edit.
c. Open the VBScript by manually entering the VBScript.
i. From the Actions palette, drag and drop the VBScript: Open action into the bot editor.
ii. In the Actions detail pane, select Manual input and enter the code in the Enter script
here field.
d. Invoke the VBScript.
i. From the Actions palette, drag and drop the VBScript: Run Function action above the
Open action in the bot editor.
ii. In the Action details pane, specify the name of the function and assign the output to a
variable.
e. Store the system date and time to a string variable.
i. From the Actions palette, drag and drop the Datetime: To String action into the bot
editor.
ii. In the Action details pane, select the System: Date – Datetime variable in the Source
date and time variable field.
iii. Assign the output to a newly created string variable.
f. Display the VBScript output value stored in the variable along with the date and time.
i. From the Actions palette, drag and drop the Message box action.
ii. In the Action details pane, click Insert variable icon in the Enter the message to display
field and then, select the variable that stores the current windows user. Additionally,
specify the variable that stores the current date.
g. Close the VBScript.
i. From the Actions palette, drag and drop the VBScript: Close action above the Run
action to close the script.
h. Click Save and run the bot.
Congratulations! You have now successfully invoked a VBScript code in a bot. The Message box
displays the username along with the system date and time.
3. Invoking an existing Python code that will get the Global Market Indices values for
Americas, EMEA, and Asia regions respectively, sort and combine all the data into
a single workbook and then send an email with the workbook as an attachment.
a. Log in to the Automation 360 Control Room.
b. Create a bot.
i. In the Getting started section of the Dashboard, click Create a bot.
2
ii. Enter a name for the bot and then click Create & edit.
c. Create three variables to hold the Global Market Indices values for Americas, EMEA, and
Asia, respectively.
i. In the Variables pane, click the Create variable icon.
ii. Select Type as Table
iii. Enter region name in the name field.
d. Open the Global Market Indices page
i. From the Actions palette, drag and drop the Browser: Open action into the canvas.
ii. In the Action details pane, enter the URL for the Nasdaq Global Market Indices page in
the Link to open field.
iii. Select the Browser as Internet Explorer from the drop-down list.
e. Capture the data from the web table.
i. From the Actions palette, drag and drop the Recorder: Capture action.
ii. In the Action details pane, select Application, and select the Internet Explorer
application window that has the Global Market Indices page open.
Note: You must click the Refresh windows icon to populate the drop-down list.
iii. Click Capture object.
iv. Navigate to the Nasdaq Global Market Indices page, hover your mouse over the
AMERICAS indices area until a red outline appears, and then click to capture it.
v. In the Action details page, scroll down to the Action to take on object field.
vi. Select the Action as Get table from the drop-down list.
vii. In the Save the outcome to a variable field, select the table variable that you had
created for Americas region.
f. Write the captured table into a file.
i. Drag and drop the Data table: Write to file action into the canvas.
ii. In the Action details pane, select Americas table variable in the Data table name field.
iii. Enter the path for the CSV files to write the data.
iv. Select the Create folders/files if it doesn’t exist and the Overwrite existing file options
to ensure that the file is created if it doesn’t exist and to overwrite the file if it exists.
g. Open the existing Python code.
i. From the Actions palette, drag and drop the Python: Open action into the bot editor.
ii. In the Actions detail pane, select the Import existing file option, click Desktop file and
then, enter the path for the file that contains the code.
h. Close the Python code.
i. From the Actions palette, drag and drop the Python: Close action to close the script.
i. Similarly, add code blocks (steps d to h) to process the Indices for the EMEA and Asia
regions.
j. Merge the individual CSV files for each region into a single workbook and send it as an email
attachment.
i. From the Actions palette, drag and drop the Python: Open action into the bot editor.
ii. In the Actions detail pane, select the Import existing file option, click Desktop file and
then, enter the path for the file that contains the code.
iii. From the Actions palette, drag and drop the Python: Execute Script action below the
Python script: Open action in the bot editor.
iv. From the Actions palette, drag and drop the Python: Close action to close the script.
v. From the Actions panel, drag and drop the Email: Send action to the step.
vi. In the To address field of the Action details panel, enter the address of the recipient.
vii. In the Subject field, update the text.
3
viii. In the Attachment (optional) section, click Desktop file, and enter the file path and
name of the CSV file as specified in the Python code.
ix. In the Message field, enter the suitable message to be included in the body of the
email.
x. In the Send email via list, select the application for sending the email.
xi. Click Apply.
a. Click Save and run the bot.
Congratulations! You have now successfully invoked a Python code in a bot. The bot will open the
Nasdaq website, get the indices for Americas, EMEA, and Asia into individual files, and then sort and
combine all the data into a single workbook. Finally, this workbook is sent as an email attachment.