Page 1 of 1

Random & List

Posted: Sat Oct 16, 2021 2:29 am
by aussietanker
I have a two similar questions.

1. I have a list something like this RA1, LA1, RA2, LA2, RB1, LB1 etc ...

I want the button command to select and type one of these combination Letter / numbers 2 from this list at random. I've tried lots of different ways with the coding but just can't get it to work.

2. I have a "set of lists" where List 1 is something like 1A, 2A, 3A, 4A ... etc while List 2 is something like 1B, 2B, 3B 4B etc and List 3 is AB, AC, AD, AE etc etc

I want the button command to give me an option to select one of those lists ie either List 1 or List 2 or List 3 and to then type the selected list out in it's entirety. Again, I've tried lots of different ways with the coding but just can't get it to work.


Can anyone help please

Thank you

Re: Random & List

Posted: Sat Oct 16, 2021 12:30 pm
by Wavget
1. You can use the random function to select and type a section of a string.

{Var1=RA1,LA1,RA2,LA2,RB1,LB1} Store the list in a variable. All items have to be the same length
{Var2 Random 6} Generate a random number between 1 and the number of items
{Var2={Var2}-1} Subtract 1 to make the random number 0 to number of items -1
{Var3={Var2}*4} Multiply the random number by the length of each item + the separator(comma)
{Var3={Var3}+1} Add 1 to get the start of the item in the list
{Copy {Var3},3,4,{Var1}} Copy the item from the list
{Var4} Type the selected item

2. The easiest way to type a long string after selecting one from a list is to use the FileList function.

First use Notepad create the listtest.txt file (in the C:\temp folder in this example)

Add this to the file:
One,1A, 2A, 3A, 4A
Two,1B, 2B, 3B 4B
Three,AB, AC, AD, AE

Then create a button:
{FileList C:\Temp\listtest.txt}

This will load the listtest.txt file and display a list with One, Two, and Three. After you make a selection it will type what is after the comma in the file.

Please let me know if you have any questions.