ActionMenuItem can run javascript on current Shotgun page

I remember seeing a thread on similar idea long time ago, unfortunately couldn't find it again. So I would be thrilled to know if it's already working.


The ideal is very simple, to be able to create an ActionMenuItem that will run a javascript in the current window.


Test case to why:

Say user wants to select a few Shots and run a packaging script on them.

Before we run the packing code (Python), I would like to open up a dialog-box and show him a few options/checkboxs.

Then I can pass his/hers input forward to a python script to handle the rest.


Currently ( to my knowledge ):

We can do all of this, but it would have to open up in a separate window, where we can do all of this.

But the downside, it's disconnecting the user from Shotgun and create a refresh issue in case we made changes to his current page.


Why running javascript inside his window would help:

A. running javascript would make it easier to dynamically create the dialog-box in his current window and show relevant information.

B. That way we  keeping the user in context. one window one thing to focus on instead of pop-ups and tabs.

C. using the power of javascript and ajax,  we can call backend-python ( django as an example ) to retrieve information we need to show/create for the user. Then he could click "submit" and off it goes to the backend.


Also I'm hoping allowing us to run javascript in the current window isn't a lot of development work for Shotgun.

Cause then I'll ask for a jQuery like API for Shotgun to control the UI... But I didn't say that... that's for 2015.


Hope it was clear,








  • 0
    Patrick Wolf

    Hi Asi, 

    i overall like the idea to extend shotgun but I think its very unlikely that Shotgun will let us run JavaScript directly on their page.
    There is a different route though. Shotgun opens a popup window via Javascript and the popup window loads an external web page.
    >JS: <a href="#" onClick="MyWindow=window.open('http://www.pixomondo.com','_blank','toolbar=noscrollbars=no, resizable=no, top=500, left=500, width=400, height=400'); return false;">Click Here</a>
    This would be easy to implement for shotgun and would leave all options open on our end to run any kind of code.
    I suggested the feature here: