activate me in Yosemite

“activate me” is not working as expected in Script Editor 2.7/Yosemite.

I have an applescript saved as an Application. After a tell block for the Finder (or within a tell block for the Finder), I want to display a dialog from the App. In Mavericks the line “activate me” would bring the App to the front. But this no longer works in Yosemite… The App icon jumps in the dock, and I have to click on it to get the dialog.

(*
Example
Save as Application
*)

tell application "Finder"
	display dialog "This is a message from the Finder" with icon 1
end tell
activate me --THIS DOESN'T WORK???
display dialog "This is a message from me" with icon 1

Curiously, it works ok when run as script from Script Editor, but not when saved as .app
Any ideas?

Using activate is problematic in Yosemite. You can use this as a workaround:

set appName to name of me
tell application "System Events" to set frontmost of process appName to true

Thanks! That works fine.

Thanks. This has been plaguing me for a long time.

Is this a bug that is planning to be fixed? Your solution, while effective, cannot possibly be what Apple has in mind…

I have no idea, I’m afraid.

Are the betas of El Capitan affected by this issue as well, then?

Not the latest one.

Good to know. We had waited on updating to Yosemite for most of our production machines due to this issue. If this issue appears to be fixed in El Capitan, we can just wait and update when it comes out, skipping Yosemite altogether.

Thanks for the help!