PDA

View Full Version : jump pages in a random


homes
10-16-2007, 04:58 PM
I am doing a project to jump pages in a random, but I do not want to repeat the pages for the second time.
I have this code ...

function SaltarPaginas(z)

if z == 1 then
Page.Jump("Lesson 1");


elseif z == 2 then
Page.Jump("Lesson 2");


elseif z == 3 then
Page.Jump("Lesson 3");


elseif z == 4 then
Page.Jump("Lesson 4");

elseif z == 5 then
Page.Jump("Lesson 5");


elseif z == 6 then
Page.Jump("Lesson 6");


elseif z == 7 then
Page.Jump("Lesson 7");


elseif z == 8 then
Page.Jump("Lesson 8");


else
Page.Jump("Lesson 9");

end


end

function GenerarNumero()

z= Math.Random(1,9);
LeeArchivo= TextFile.ReadToString("AutoPlay\\Docs\\MyFile.txt");
Buscado = String.Find(LeeArchivo,z, 1, false);
Label.SetText("Title",Buscado)
x = String.ToNumber(Buscado)
return x;


end


function Generar()

x=GenerarNumero();
if x == -1 then
SaltarPaginas(z);
else
LeeArchivo = TextFile.ReadToString("AutoPlay\\Docs\\MyFile.txt");
UltimaPagina = String.Right(LeeArchivo, 1);
z = String.ToNumber(UltimaPagina)
SaltarPaginas(z);
end
end

generar();

Can someone help me with this.