How to get a variable's value from another Marcro?

Hello Guys,

I have two Macro, Macro1 and Macro2.
there is a variable “MyVal” in Macro1.
When I use “run” to call Macro1 in Macro2, how can I get the variable MyVal’s value of Macro1?
{
“Name”: “Macro1”,
“CreationDate”: “2020-6-12”,
“Commands”: [
{
“Command”: “store”,
“Target”: “123”,
“Value”: “MyVal”
}
]
}

{
“Name”: “Macro2”,
“CreationDate”: “2020-6-12”,
“Commands”: [
{
“Command”: “run”,
“Target”: “Macro1”,
“Value”: “”
}
]
}
Thank you Guys.

Save the variable like Globalvariable and it can not reset until you close the browser.

https://ui.vision/rpa/docs#globalvar

2 Likes

How is the subroutine related the main program?

  • Variables are visible in the subroutine.
  • If the value of a variable is changed in the subroutine, it changes the value in the main macro, too (“Call by reference”).
  • Use global variables is another option, but not required. The remain filled even if the macro has stopped, just as @newuserkantu mentioned.
2 Likes

Got it, thank you Guys.