replace name with num value
andy_c
✭
Hi,
I have a slight problem, i have a randomGenerator witch gives me a number between 0 and 200. And i have 200 routines named "routine1, routine2" etc. And i want to do the rutin by random from the number i get from the randomGen. So to my question:
How do i replace the number 1 in routne1 with the value i get from my randomGen?
BR
0
Comments
-
you could make a routine that accepts your number and use test / case to run each of your individual routines..TEST RandonNumCASE 1 :Routine1;CASE 2:Routine2;ENDTESTlittle bit tedious.. but without know what your doing with the 200 routines i cant think of much better.0
-
Hello,You can use something called late binding to do this in a much simpler way. Please see the following example code:randomNumber :=GetRandomNumber;routineName := "Routine" + NumToStr(randomNumber, 0);%routineName%;This will call the routine with the name "Routine1" (if randomNumber is 1).Good luck!BR frpa0
-
HiYou can useCallByVar - Call a procedure by a variable
Example
reg1 := 2;CallByVar "proc", reg1;
Regards
Knud Erik Lindberg
Jorgensen Engineering0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings