Random Button Selection

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Carnivean
Newbie
Posts: 17
Joined: Fri Jun 10, 2011 8:04 am

Random Button Selection

Post by Carnivean » Fri Sep 09, 2011 1:36 pm

Hi

I'm trying to select a number of buttons on an application that I'm testing. Currently I'm using the 'PushButton' command and pressing in sequential order as seen in the script below, there are actually 9 cameras on test but the script below only shows 3. What I'd like to do however is select them randomly. I've tried using Random (see below)but am obviously not doing something right. Can anyone help please?

Code: Select all

PushButton>LCS,Camera 1
 Wait>1
 PushButton>LCS,Camera 2
 Wait>1
 PushButton>LCS,Camera 3
 Wait>1

Code: Select all

Random>{Camera 1, Camera 9},rand
Let>rand=rand+1
PushButton>LCS,%rand%

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Fri Sep 09, 2011 2:27 pm

Try this:

Code: Select all

Random>10,rand
If>rand=0
  Add>rand,1
Endif
PushButton>LCS,Camera %rand%

Carnivean
Newbie
Posts: 17
Joined: Fri Jun 10, 2011 8:04 am

Post by Carnivean » Fri Sep 09, 2011 2:36 pm

Thanks, works a treat

Easy when you know how!!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts