RobotStudio event

Task Variables

It is possible to use the same variables in more than one task, by that i mean creat the variable in one task and the the value on other one??

Thanks

Comments

  • Hi Ricardo,

    You need to define that variable as Persistent in both tasks.

    e.g

    PERS num nVar:=1;     

    BR.
    Erdem Karaçeper
  • I have tried to avoid this because I was unsure how it would work.
     

    if task 1 has it defined as =1 and task 2 has it defined as =2.

     

    What will it equal, will it have different values for each task or take whatever value it was assigned last?
  • Thanks it works fine! Wink
  • I just want to say that this is a quiet interesting post that you have mentioned here. keep it up.

  • mattdavis,
    As I could notice here, the variable keeps the las assigned value, it does not matter if it was done in Task1 or Task2. But there is something you must keep on mind: you can only initialize a shared persistent in one task. It means the declaration PERS num nVar:=1;    should appear only in Task1 or in Task2, never in both.