Check for a running App/Engine before launching App

I have a couple tk-apps that launch Photoshop from the Shotgun browser. Some times I want to open a fresh instance of Photoshop, which is good because thats all I currently know how to do via engine.execute_command().

But what I really would want in some cases is to just foreground the the currently running Photoshop/Engine instance and open the file. This would save the launch time and the time it takes to spin-up the engine.

So, how would I…

  1. Check to see if the PhotoshopCC engine is running.
  2. Tell the engine to open up the file so I don’t need to launch a new instance (and engine).

Are they all connected with a ‘parent’?

Thanks,
Daniel

2 Likes

Hi Daniel

Sorry for not getting back to you sooner, I was off last week.

Toolkit doesn’t maintain a live connection between the engine launching the software and the subsequent engine running in the launched software, so there isn’t a builtin method you could use to do this.

One approach I can think of is to build an app that runs in Photoshop that would listen over a port for commands. Then when you run your action from the Shotgun browser it could send the request to the app over the port with instructions to open a file. The app would also have to respond back accepting the request so that you know whether an existing engine exists or if you need to launch a new one.

I’ve done something similar before using the QT modules:
https://doc.qt.io/archives/qt-4.8/ipc.html

Hope that helps?
Phil

1 Like