Is there a way to shorten this script? (100 graphics and 200 lines of text)

Dar Scott dsc at swcp.com
Tue May 8 14:44:16 EDT 2012


Yeah.  The d subscript needs to be calculated based on i.  (Or the loop changed so the line subscript is is based on the d subscript.  (In my version, I cheated and just deleted lines as I used them.)

Dar

On May 8, 2012, at 12:32 PM, John Dixon wrote:
> 
> that won't work...
> 
>> 
>> repeat with i = 1 to 200 step 2
>>  set the backgroundcolor of grc "d1" to the text of line i of fld "in"
>>  set the foregroundcolor of grc "d1" to the text of line i+1 of fld "in"
>> end repeat
>> 
>> Bob
>> 
>> 
>> On May 8, 2012, at 11:21 AM, William de Smet wrote:
>> 
>>> Hi there,
>>> 
>>> Can anyone help me shorten this script?
>>> Eventually there will be 100 graphics (d1 to d100) and 200 lines of
>>> text in field "in"
>>> Each graphic uses two lines of follow up numbers (correct English?) of fld "in"
>>> --------
>>> set the backgroundcolor of grc "d1" to the text of line 1 of fld "in"
>>>  set the foregroundcolor of grc "d1" to the text of line 2 of fld "in"
>>>  --
>>>  set the backgroundcolor of grc "d2" to the text of line 3 of fld "in"
>>>  set the foregroundcolor of grc "d2" to the text of line 4 of fld "in"
>>>  --
>>> set the backgroundcolor of grc "d3" to the text of line 5 of fld "in"
>>> set the foregroundcolor of grc "d3" to the text of line 6 of fld "in"
>>> --
>>> set the backgroundcolor of grc "d4" to the text of line 7 of fld "in"
>>> set the foregroundcolor of grc "d4" to the text of line 8 of fld "in"
>>> --
>>> set the backgroundcolor of grc "d5" to the text of line 9 of fld "in"
>>> set the foregroundcolor of grc "d5" to the text of line 10 of fld "in"
>>> --
>>> 
>>> Thanks!
>>> 
>>> Greetings,
>>> 
>>> William




More information about the use-livecode mailing list