I see that the OP's question says "an application made in Automator."
But, as an aside, and since this question has most of the right keywords to solve the problem I was having (applications launched from an Automator "Run Shell Script" action showing up behind other open applications)…
If you are launching a GUI application from a shell script action in Automator and find that it is not coming to the foreground and receiving focus, try something like
open -a ProgramName.app --args "$@"
and set "Pass input" to "as arguments". The
"$@" will be expanded as an individually-quoted list of the input arguments, separated by whitespace (this is a feature of the Unix shell, not Automator).
This works great, for example, for creating a "Writer" Automator app that launches LibreOffice Writer (
open -a LibreOffice.app --args --writer "$@"), and also accepts drag-and-dropped files.
If you are still having trouble getting the application to come to the foreground (maybe it's already open, for example), try appending these lines to the action in Automator:
sleep 1 # adjust as you see fit
osascript <<<'tell application "ProgramName.app" to activate'