Date: Wed, 1 Mar 1995 10:33:34 +1000 From: Dorian Dowse <bakira@DESIRE.APANA.ORG.AU> Subject: Re: Formatting and placing lists... > I've been trying unsuccessfully to format a copy of a linear list and then > place it into a field as a string. The main difficulties I'm encountering > are removing the open and close brackets, and inserting RETURNs after each > list entry.
Try this:
repeat with i = 1 to count(myList)
put getAt(myList,i) into x
put x & RETURN after field "whatsit"
end repeat
Date: Tue, 7 Mar 1995 23:37:25 -0500 From: STEVEN GERBER <sg0075@EPFL2.EPFLBALTO.ORG> Subject: TIP: fast text field initializationA tip for beginners or anyone else who hasn't yet discovered this Director quirk.
When building text fields, NEVER do this:
repeat with i = 1 to 50
put getAt(myList,i) after field "TEXT"
end repeat
Instead ALWAYS do this:
set tempString = ""
repeat with i = 1 to 50
put getAt(myList,i) after tempString
end repeat
set the text of field "TEXT" to tempString
To see the speed difference for your self,
which I always want to do ;) try the following
benchmark script.* Note: you need to create a text field called TEXT before running the script.
on startMovie
-- Creating a list of strings of numbers
-- such as ["1 1 1", "2 2 2", etc.]
startTimer
set myList = []
repeat with i = 1 to 50
set aStringOfNumbers = string(i) && string(i)
append mylist, aStringOfNumbers
end repeat
put "List created in " & (the timer/60.0) & " seconds"
-- Method One
startTimer
repeat with i = 1 to 50
put getAt(myList,i) after field "TEXT"
end repeat
put "Method 1 took " & (the timer/60.0) & " seconds"
-- Method Two
startTimer
set tempString = ""
repeat with i = 1 to 50
put getAt(myList,i) after tempString
end repeat
put tempString after field "TEXT"
put "Method 2 took " & (the timer/60.0) " seconds"
end startMovie
My Power Mac 7100 puts the following
into the message window.
-- "List created in 0.1833 seconds" -- "Method 1 took 5.6000 seconds" -- "Method 2 took 0.2167" " seconds"
Now if I could only find some trick like this for setting text styles!
Steve Gerber
Meetinghouse Technologies
Annapolis, Maryland