I see that you have figured it out. Yes, you have to use the "Detect Active Application..." script FUNCTION.

Friedrich