Hi,
With the following code (on a page), the page just freezes. I realise that I need some sort of loop on the page, to continue, but I am not sure how to do this. (I have never done any sort of programming before, except for batch files, in which I could use "GOTO")
If there was a “SWITCH” function, I think that I could more easily have achieved what I need to do.
I managed to do some of what I require without Opusscript, using select/case (similar to Switch/case), but this would have resulted in a clumsy programme with a lot more work, not only when writing the program, but also when trying to update it, which is fairly regularly.
Here is my script, which obviously has errors. If the sections commented on with // are removed, the script works initially, but “freezes” after the first phase.
I realise that the entire script is very clumsy, but I am trying to learn how to write Opusscript. (any recommendations would be appreciated)
I struggled to refer to a variable from a variable, so I used "read first line from file" to set <tloc> and "read next line from file" to set <loc_t> instead. A cop-out, I know, that may slow the programme down, but it worked.
The first document (set by variable) refered to in the script has a first line as "1,1,0,0,1,0,1,0," and a second line as "9" The second line is used to set the variable <loc_t>
The 2nd document (set by variable) refered to in the script has a first line as "0,1,0,1,0,1,0,1," and a second line as "1000" The second line is used to set the variable <loc_t> The reason I used 1000 for the second variable is that the user is able to toggle LE_1 as many times as they want before pressing a button to exit this component.
Code:
C:\Documents and Settings\Nitro\My Documents\My Prog\<loc_new>.txtvar get_loc;
get_loc = tloc;
var cloc = new Array(<loc_t>) //loc_t is a variable, I was trying to set the length.
var cloc = get_loc.split(',');
var floc = cloc[0];
var L1 = cloc[1];
var L2 = cloc[2];
var L3 = cloc[3];
if (floc == "0")
if (L1 == "1")
{LE_1.Show()}
if (L1 == "0")
{LE_1.Hide}
for (loop = 1;loop<cloc.length;loop++) // this creates a problem.
if (floc == "1")
if (L1 == "1")
{LE_1.Show()
LE_2.Show()}
if (L1 == "0")
{LE_1.Hide}
for (loop = 1;loop<cloc.length;loop++) // this creates a problem.
else
{LE_8.Show()}
for (loop = 1;loop<cloc.length;loop++) // this creates a problem.
Please help...
Neil