Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)

I am trying to return multiple variable as an output from js Script in AutoamtionAnywhere. For example I have js script like this:

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Monday', 'Tuesday'];

var months = ['January', 'February', 'March', 'April', 'May', 'June', 'August', 'September', 'October' , 'November', 'December'];

var d = new Date();

var week_day = days[d.getDay()+2];

var day_number = d.getDate();

var month_name = months[d.getMonth()];

var month_number = d.getMonth();

if(month_number <= 9){

    month_number.toString()

    month_number = "0" + month_number

};

WScript.StdOut.WriteLine(week_day, day_number, month_name, month_number); 

In AAE I am also putting 4 different variables as an output (With comas and with only spaces):enter image description here

After running BOT I am receiving following error: enter image description here

1 Answer

0 votes
by (29.5k points)

The return value in the “Run script” does not support multiple variables but in order to achieve what you are trying you can return the values by concatenating the values with some character

.WScript.StdOut.WriteLine("ReturnValue1#ReturnValue2");

Your bot should fetch this value in one variable(say $Prompt-Assignment$) and then you can split it with string operator and assign it in some list variable.
 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...