animate text

probably a rather basic question but can anyone suggest the simplest way to
automatically scroll (loop) text in a text field with a string that is too large to fit in the said text field
I presume that I have to use the animate command but am not sure how?

I have failed to find any specific help with this in the developer docs

many thanks


Ps I have also posted this in the cocoadev list, I could use a cocoa or applescript solution.

There’s a script in ScriptBuilders that might provide a basic starting point. File Message 1.0, by Piero Garzotto, scrolls a user-defined message through the name of a file.

– Rob

I use this routine in LiveTour (open source)

to slideNew(t)
	repeat with i from 1 to t's length
		tell mainWindow
			set content of text field "text" to text i thru -1 of t
		end tell
		if quickRead then
			set z to 3
			set z to 10
		end if
		repeat z times
			do shell script "sleep 0.9"
		end repeat
	end repeat
end slideNew

I know this routine is pretty bad and domestic, but it will do the job.
“mainWindow” is the window which contains the text field “text”.
And “quickRead” is a user-defined preference, which will, ahem, make the scrolling quickest or slowest.
As you see, I use shell’s “sleep”, which someone told me was less CPU intensive. But anyway, if I use it 10 times in a repeat loop, it is in fact, absolutelly CPU intensive.
“0.9” doesn’t work, it probably maps to “0”, but it’s a psychological enhacement for me.
If you are planning a scroll-based app, I’d suggest you finding a really good routine, but this may work for some tests…
I was thinking that it could be done using SMIL commands, which are plain text files with some instructions which QuickTime translates into movie clips. Eg:

<root-layout id="rl" width="320" height="40" 
background-color="black" /> 

<region id="slides" width="320" height="40" /> 

<text src="data.txt" dur="0.5 sec" region="slides" /> 
<text src="data2.txt" dur="2 sec" region="slides" /> 

Create both “data.txt” and “data2.txt” and type some text onto them. Save this file and open it from QuickTime. It will draw a black-background movie. If you click “play”, you will see the animation. If you think in this, it can be very powerful!.. If you are interested, you can take a look here:

Thanks for the suggestions!
I’ll let you know how I get on