I've created an application with AppleScript in Automator.

I've created a Service in Automator which launches the aforementioned app.

The Service is triggered by a keyboard shortcut.

The problem is that upon launch, the application's dialog box has a light gray top bar. I have to click anywhere on the dialog for the dialog to turn to the darker gray, which shows that the app is now selected.

Is it possible for my application to do this automatically?

  • Do you have an activate command after the start of the on run handler? (In the app, not the service.) – user3439894 Nov 19 '16 at 5:32
  • No, there is no activate command in the entire app. Also, the issue occurs with every one of my Services and it occurs even if I run the Service manually (via the "Services" menu in the top left corner of the screen). – rubik's sphere Nov 19 '16 at 5:33

Have a look at the activate command in the AppleScript Language Guide Commands Reference.

activate Brings an application to the front, and opens it if it is on the local computer and not already running.

I'd add activate me after the start of the on run handler.

  • activate me solves the problem. I wonder why this is not the default behavior of AppleScript applications. – rubik's sphere Nov 19 '16 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .