Write robot programs in python

Hello!
I am a programming rookie, I would like to ask how to specify the use of tools for the action statements in the robot program through python.

Hy,

specifiy the Tool used from the statement with:

statement.Tool = vcrobotcontroller.Tools[index]

Regards

Feature

Thank you very much, this solved my problem.

How do you add statement to “Then” and “Else”?
Also, why do I get “Error in property ‘Condition’. Property ‘R52’ in expression ‘R52 >= 1 & R52 <= 224 & R53 >= 1 & R53 <= 224’ is not found.” I have defined ’ R52 ', and as a global variable.

The output error originated from one of my mistakes and can be ignored.

But how do you add statement to “Then” and “Else”?

Hy,

by looping the statements to find the Then and Else or with “findRoutine” and then do the magic…

Regards

Feature

thank you for your support!
Do you mean to use a loop statement? Writing with loop statements can be problematic.
If not, can you give me an example?

Hy,

no Loop-Statement, loop your statements to find your “then” and “else” statements to edit it programatically!

PseudoCode:

for st in yourProgram.Statements:
  if st.Name == "Then":
    DoWhatYouWant
  elif st.Name == "Else":
    DoWhatYouWant

Regards

Feature

This method is great, thank you!