Making Your Own App Come To the Foreground
Mac OS 9 Mac OS X

Although you can use AppleScript to cause an application to come to the foreground (see proc001 - Making an App Come to the Foreground), you usually need to know what application you are talking to and then address it directly with the 'tell' command. Of course that assumes that you know the name of the application, which means parsing the 'filename' of a stack, etc.

Here's a simple way to cause your own application to come to the foreground without having to go through that extra effort:

on mouseUp			
  send "ActivateMe" to me in 10 seconds
end mouseUp

on ActivateMe
  do "tell current application to activate" as AppleScript
end ActivateMe

Posted 9/21/2007 by Ken Ray