Need a script to keep an application in front.

Hello,
I’m pretty new with apple script and am trying to make a script that will make itunes the active application every 5 mins or so.

What I have is the keyspan IR receiver and the application has to be in front for it to work. The computer is being used for an entertainment system so it is pretty much only running itunes.

If something else gets used and itunes is not on top the keyspan device doesn’t work.

Thanks for any help.

You can try this, saved as stay-open application:

on idle
     tell app "iTunes" to activate
     return 5 * 60 --> 5 minutes
end idle