Adding a statement to the main routine place it at the end of the program, i.e.
executor.Program.MainRoutine.addStatement(‘Process’)
If I want to place it after a selected statement, like this
executor.Program.MainRoutine.addStatement(‘Process’, index)<b></b><i></i><u></u>
How can I find the selected statement and it’s index?
1 Like
I guess you can use getApplication().SelectionManager.getSelection(VC_SELECTION_RSLSTATEMENT)
fredrik
3
I tried that, but I get an error, “global name ‘VC_SELECTION_RSLSTATEMENT’ is not defined”.
Also in the manual it says “Deprecated”
Thanks anyway
Try this, getApplication().SelectionManager.getSelection(VC_SELECTION_STATEMENT)
Ok, this worked.
Next, what’s the best way to find the index of the statement in the program?
Iterate through the “List of vcStatement” from vcScope object?
Thanks
1 Like
Chungmin, no need to answer I solved it, very simple, just use 'Statements.index(…)
1 Like