cancel
Showing results for 
Search instead for 
Did you mean: 

Passing argument to Blue Prism - Script Execution VBO

Hi All,

I am trying to pa arguments to Blue Prism - Script Execution VBO  but unable to do the same,
Please anyone guide me on the same.

I am just trying below simple code,

29489.png29490.png
Output is appearing blank.
------------------------------
Amlan Sahoo
RPA Consultant
Equinix
------------------------------
Regards,
Amlan Sahoo
23 REPLIES 23

Hi @ewilson still no luck PFA for that,

29441.png

------------------------------
Amlan Sahoo
RPA Consultant
Equinix
------------------------------
Regards,
Amlan Sahoo

I'm no Python programmer, but this seems to work. In the future, if you have a specific use case it would be easier for you to simply post your script for others to test with then to ask someone to recreate your specific use case from a screen shot.

import sys

def add(a, b):
	result = int(a) + int(b);
	return result;
	     
# Addition of numbers
Sum = 0

Sum = add(sys.argv[1], sys.argv[2]);     
print(Sum);
​

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

See my post above. FWIW - The script that you've pictured above will not add the two numbers together as an addition action. It will concatenate them as strings. In other words, the output will be "ab" instead of the value of a + b.

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Hi Eric,
Thanks for that I have copied the same code what you have provided but still no luck.
import sys

def add(a, b):
result = int(a) + int(b);
return result;

# Addition of numbers
Sum = 0

Sum = add(sys.argv[1], sys.argv[2]);
print(Sum);

Could you please show me how youa re passing the arguments if I am trying to pass then there is no result.
This is how I am passed ,
29451.png


------------------------------
Amlan Sahoo
RPA Consultant
Equinix
------------------------------
Regards,
Amlan Sahoo

Sill no luck Eric. Hope I can get some help.

------------------------------
Amlan Sahoo
RPA Consultant
Equinix
------------------------------
Regards,
Amlan Sahoo

Basically the same thing as you have shown. Only difference is that I'm using Python 3.8, as a dedicated install vs Visual Studio.

29458.png


------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Remove the trailing "\\" from your ScriptFilePath so the value is C:\\Users\\asahoo\Desktop\\Python

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Did you try removing the trailing "\\" from your ScriptFilePath as I mentioned above?

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Thanks a lot Eirc it worked.
But one question do we need to pass argument always as mentioned below,
Or is there any other way?
I am just curious to know.
Sum = add(sys.argv[1], sys.argv[2])​


------------------------------
Amlan Sahoo
RPA Consultant
Equinix
------------------------------
Regards,
Amlan Sahoo

That's just a quick-and-dirty way of capturing two command line arguments. There are much better and more fault tolerant ways of doing it, but it's up to you to handle that in your Python development. You can use a statement like what I've shown below to get the total number of command line arguments that have been passed in and then work through a loop to load them into other variables or whatever you want to do with them.

n = len(sys.argv)

# Addition of numbers
Sum = 0
# Using argparse module
for i in range(1, n):
    Sum += int(sys.argv)
​


------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------