ask an open app to run

Scenario: I have an open app, I click its icon in the dock.

Is there a way of making it do something each time I click?
ie is there a method that notifies that the app has been clicked?

Thanks
PS I tried

on applicationDidBecomeActive_(aNotification)
	log "here I am active"
	applicationWillFinishLaunching_(me) -- this is where my code executes. (it all worked fine when I used to quit at the end of this)
end applicationDidBecomeActive_

but it throws the app into an endless loop…

Yeah, you need to look at the app delegate methods. Those are the ones that when something happens it sends a message back to the app that set it up.

Look at app delegate.

The applicationWillFinishLaunching_() method is for the app to call, not you. Put what you want to do in your own handler.

Thanks to you both.

As usual… spot on Shane.

also, in a regular applescript app, you can add a on reopen handler, so that every time you double click it will go to the reopen handler while the app is still running.

gl,
kel