can someone please answer this question?

How can I tell a script to GO AWAY for X amount of time??

referencing this post: http://bbs.applescript.net/viewtopic.php?t=10736

I am speaking about a problem where I am updating iChat status information every 5 seconds---------- In order to do this, I must to:

set thedate to (current date) 
   set thetime to time of thedate 
   set thetimeahead to thetime + 5 
   repeat until dogfood 
      if thetime = thetimeahead then 
         set dogfood to true 
      else 
         set thedate to (current date) 
         set thetime to time of thedate 
      end if 
   end repeat 
end repeat 

This results in my script taking up 95% of my cpu power because it is processing this loop over and over every second-- trying to see if five seconds have gone by.

How can I eliminate this problem??

How can I say “Mr. Applescript… Please tell my G5 to tend to system processes and come back in 5 seconds…”???

thank you…
p.s. I wish more people responded on this board!!!

You can use “delay” (which still takes lots of cpu) or use a workaround described several times in several places: use shell’s “sleep”, which is less cpu-intensive:

delay 5
do shell script "sleep 5"

And, if your app is concibed to do something every 5 seconds forever, you may use an “idle” handler, which is low-cpu-intensive, and the native mechanism in AppleScript for such tasks. Read this:
http://macscripter.net/faq/general.php?id=P70
And this:
http://macscripter.net/faq/general.php?id=P46