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:38:09 EDT 2012


I'm not sure what you intended with the "text of" object expression, so I made an assumption.  That can be modified to fit your real need.

Perhaps something like this (untested):

put field "in" into colorLines
repeat with n = 1 to 100
	get "d" & n
	set the backgroundColor of graphic it to line 1 of colorLines
	set the foregroundColor of graphic it to line 2 of colorLines
	delete line 1 to 2 of color lines
repeat

Dar Scott

On May 8, 2012, at 12:21 PM, 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
> 

---------------------------
Dar Scott
dba 
Dar Scott Consulting
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, home, office phone: +1 505 299 9497
For Skype and fax, please contact.
dsc at swcp.com

Computer Programming and tinkering,
often making LiveCode libraries and
externals, sometimes writing associated
microcontroller firmware.  
---------------------------






More information about the Use-livecode mailing list