Use Automator to open app as itself

automatorterminal

I'm trying to figure out how to launch an app (in this case Discord) by default with added commands, and as such I figured I'd use Automator to create an app that runs a shell command.
The command in question is as follows:

MKL_DEBUG_CPU_TYPE=5 /Applications/Discord.app/Contents/MacOS/Discord

I put that on Automator, on the "Execute shell script" action, save it as an application, and when I put the app on the Dock, when I launch it, it shows two icons. Well, the cause of this is obvious, it's not launching the app itself with that command, what is in the dock is just a glorified terminal window which always launches the discord app with that command.

My question is: Is there a way I can do it so the command doesn't show two discord icons, and the discord window opens in itself?

Also because language barriers and bad communication are a thing, here are a few screenshots that illustrate my question better than words can

The Automator app, on the Dock The Automator app, on the Dock
After launching the Automator shortcut, this is what happens After launching the Automator shortcut, this is what happens
This is what I'd prefer to happen This is what I'd prefer to happen

Edit: I'm not sure if this was clear to you guys, I wasn't even aware of this, but it seems that MKL_DEBUG_CPU_TYPE=5 acts as a command itself, which then runs the mentioned app with it's own properties, it's not a command parameter that Discord.app recognizes

Edit 2: Just to clear things out a bit more, when I run the Automator Application, it doesn't show the white dot that indicates the app is running, nor does it show the notifications number that stock Discord does, and that's what I'd like to happen on the Automator app, while hiding the real Discord icon from the dock

Best Answer

Does it have to be Automator?

I have an app which will take additional parameters at launch, which I do by saving an Applescript as a self-contained App.

The basic config is

do shell script "\"/Applications/NameOfApp.app/Contents/MacOS/NameOfApp\" -param1 -param2 -param3"
quit

Edit - Ah, reading more carefully, nope, that doesn't hide the icon of my applescript whilst it's running, & it will not quit until the launched app is itself first quit… but it wouldn't be confused for the app itself.
They are parent/child processes so will be displayed individually in the Dock.

You may be able to hide it like this question - Hide a running app from Dock?
…which rather makes this answer a bit pointless ;-)