Bring non App Window to front

Not sure how to sort this one.

I am calling an AppleScript from my application to open a note from Evernote and then the script returns control back to my app.

The problem is, when my app gets control again it comes to the front, covering the Evernote window. What I need to be able to do, is bring the Evernote window back to the front and give it focus.

I have “activate” in the AppleScript, which works - for about 1 second - then my Xojo app pops back to the front.

Any ideas?




tell application “System Events” to set frontmost of process “My Application” to true

Activate reverts back to the application which invoked the applescript after it has executed.