Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.
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
Danrobotics0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 16 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 365 IRC5
- 86 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 854 RAPID Programming
- 37 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings

