How to activate program running from an executable file?

When Automator asks me to locate the program, it is unselectable. I’m guessing this is because it’s an executable file and not an application. Can I use AppleScript to get around this issue?

My goal is to create a script so that I can assign a keyboard shortcut to activating Minecraft. The problem is that the Minecraft application file can only start the Minecraft Launcher. But rather than the launcher and game being in the same file, the launcher somehow targets the executable file “java” and runs that at the same time. So when I start the game, if I move my mouse over the dock, the icon representing the running game is just called “java”. The problem is I can’t figure out how to target “java” from a workflow or AppleScript, so I don’t know how do anything in relation to that process.

Essentially I would like to get this code, from to work with Minecraft.

set appName to "Mail"
set startIt to false
tell application "System Events"
	if not (exists process appName) then
		set startIt to true
	else if frontmost of process appName then
		set visible of process appName to false
		set frontmost of process appName to true
	end if
end tell
if startIt then
	tell application appName to activate
end if

Does anyone have any ideas for how I can get around this issue?

I’d start by trying this:

tell application "System Events"
	return the name of every process
end tell

Run that, look through the returned items for the process name Minecraft is using, then replace “Mail” in your posted code with whatever you found.

Although if it is simply “Java,” then this doesn’t sound very promising in the event it needs to be launched. But if it’s open and just needs to be brought frontmost, I suspect it will work.

Thanks t.spoon, I got it! To be honest, this was all a very silly mistake. All I had to do was make “java” lowercase!:smiley: