switching which external files to use

Sarah sarahr at genesearch.com.au
Thu Jul 18 19:13:01 EDT 2002


I would rename the original set of files so they all have 1 at the end 
of their names. Then you can use something like:

put 2 into fileNum
put URL ("file:data/SFQuizzes/SFQuiz1/Instructions" & fileNum & ".txt") 
into fld "instructions"
put URL ("file:data/SFQuizzes/SFQuiz1/Answers" & fileNum & ".txt" into 
fld "answers"

if you structure the file names carefully, your switch routine should 
just set this number and then you will have a general routine to use the 
files. This will make your script much less verbose and easier to debug.

In your script you have the following four lines which do the same thing 
twice. You can either delete lines 1 & 3 completely, or leave them and 
change lines 2 & 4 to say "set the whatever to it"

    get URL "file:data/SFQuizzes/SFQuiz1/questions2.txt"
    set the questions of group "quesControl" to URL 
"file:data/SFQuizzes/SFQuiz1/questions2.txt"
    get URL "file:data/SFQuizzes/SFQuiz1/corrAnswers2.txt"
    set the corrAnswers of group "quesControl" to URL 
"file:data/SFQuizzes/SFQuiz1/corrAnswers2.txt"


Cheers,
Sarah


On Friday, July 19, 2002, at 07:21  AM, Kristy Roggio wrote:

> Now, this is great if I only have 2 different sets...the originals and 
> the "2" set.  How do I tell it to cycle through the next set of 
> external files?  Can I use a repeat cycle to insert the info from 
> "/Instructions3.txt" and the rest of those txt files the next time the 
> user wants to take that quiz?  How do I automatically change which 
> question set files are being accessed?  I hope my question makes sense, 
> and any help would be a life saver.





More information about the use-livecode mailing list