View Full Version : Generate a predetermined number.
I want to create a program in autoplay media studio which can generate a given text or password. For instance: the program has 100 given codes like "SP1HK8KADA8D" or any other text. When i press a generate button it sould generate a random code form the 100 given codes. It can't be the same as the last code...
Also: I'm a noob at AMS.
Sorry for my broken english :P
codes={"iugz56erzti", "345345345","345345345","985th85eu"}; --and so on
random=Math.Random(1, Table.Count(codes));
randomcode=codes[random];
I don't get it :s It's my first experience with code. Should i copy the code to the generate button or the input box?
Table codes contains all the codes. You might hardcode this table or load it from a file on disk via TextFile.ReadToTable() command. In my example I hard-coded it. This part would go on the page's On StartUp event.
The other two lines do the actual randomization. First line creates a random number between 1 and the amount of entries in the table. You would put this code on your button.
What you need next is to somehow display this randomcode variable content to the end user. You might put the password into input field via Input.SetText() command or display it using Dialog.Message().
It works! Thank you for your help... I really appreciate it.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.