Executing a system command

What does it look like to send a terminal command out from SG? I have toolkit running in default. I’d like to try setting up a command from SG that sends out a DOS/Terminal command to launch After Effects and start a render. I’ve been looking at the toolkit docs for a while but it’s all still an overload so I definitely don’t have a good grasp of where to look and what to start with.


Hey Byron!

Can you tell us a little more about what you’re after? It sounds like you may not need to Toolkit for this at all. There are a few features that Shotgun and Toolkit offer around running custom code:

  • Toolkit Software launchers: we use these to launch Software like Maya, Nuke, etc. in a Shotgun-aware way – either from Shotgun Desktop, Create, or from Shotgun itself. Usually we use Software launchers to launch existing content creation platforms, so that they’ll have Toolkit apps available
    within them, based on what’s specified in your pipeline configuration. But you could ostensibly point to any executable. You can learn more about Software launchers here.
  • Toolkit custom apps: We provide a platform that you can use to build custom Toolkit apps – UIs within content creation software that can build on UI widgets we provide and use our APIs to access your Shotgun data. I feel like this may be overkill for what you’re after, but you can learn more about Toolkit app development here.
  • Finally, the Shotgun web app supports Action Menu Items, or AMIs. This is a framework where you can create context menu items on entities in Shotgun that run arbitrary code that you specify. Note that this isn’t part of the Toolkit platform, just a feature of the Shotgun web app itself. Based on what you’ve said, I think this may be your best bet. You can learn more about AMIs here (links are in the left nav).

Hope that helps! Let us know if you have any other questions.

1 Like

Thanks for the reply @tannaz. I do agree that the AMI may be what I’m after. What I’d like to set up, is the ability to right click on a shot and have the option to render it in After Effects. After Effects has a command line render option (aerender.exe). I have all the information I need in Shotgun already ( published file location for the latest AE project, name of the composition, etc…). The resulting command line argument sent to the system should be pretty simple. I would just need to get those few pieces of data from SG and then send that command to the command line.


Yeah, that sounds like an AMI to me… =)

1 Like

Hey @tannaz! I’m attempting to test out an AMI command. Where is the output displayed? I right click on the entity in the SG web interface, select my AMI, and the output goes where?


Hi @Nik,

Here’s a part of our 2019 Siggraph Developper Day content which covered Action Menu Items:

In a nutshell, the URL that you specify in the AMI setup will be sent a payload to. There’s no output per sé unless you implement something at that URL to capture the payload and do something, like display it.

If you know your way around your browser’s debugger, you can use that to see the network call being sent out. The network call will contain the URL and payload. Just open your browser debugger to the network panel prior to clicking on the AMI to see it in action.

If your URL isn’t an HTTP/S URL the browser won’t be able to handle it on it’s own and will need to defer to the OS and any locally installed application which is registered to handle your URL’s protocol. This is when these documents comes in handy to link your custom protocol to a script on your local computer.

If you’re using a custom protocol, which you probably are if your intent is to start a local application, a development and debugging process I particularly enjoy goes as follows:

  • Create your AMI in Shotgun using a custom protocol
  • Start the debugger in the network panel
  • Execute your AMI on a given entity
  • Grab the generated URL from the network panel
  • Develop and debug your script using the command line with the URL from the previous step as the first argument.

If your script works from the command line, you know your code is OK. Then it’s all about linking the custom protocol to your script using the second piece of documentation above.

Sure hope this helps.