Executing Scripts From Asset Browser

From Zoom 6.0 and above, right-click context menu in Asset Browser can be customized to invoke the pre-configured scripts.

Brief:

Automation is beneficial for Zoom users by allowing them to take mundane tasks and automate them using scripts. Currently, in Zoom, we have support for automation scripts using the Workflow functionality on the Zoom Server. However, there may be instances where we may have to accomplish tasks that require a combination of information from Zoom repository, as well as the locally installed software (like Adobe tools etc.) or access to physical files located on the client machine. For these requirements, executing scripts on the server alone may not suffice.  

To help alleviate this issue, Zoom has put together a framework from within which users can invoke and run pre-configured scripts on their local client machines. This feature lends itself nicely to enhance the already rich repertoire of tasks that Zoom provides, by providing custom actions that can be executed on Zoom assets much the same as any other operation from the context menu in the Asset Browser. 

Through the configurable options, users can add items in the context menu. On right click after selecting any assets in Asset Browser, users will see these “action items” in the context menu and on click to any of these menu options, the corresponding configured script gets launched. The script will receive the asset ID and the name of the selected asset as the argument to the script.

Steps To Add Scripts In Context Menu :

  • Create ScriptExecutorSpec.xml in $HOME/.zm
    /Users/joe/.zm/ScriptExecutorSpec.xml
  • Put the below XML content in the ScriptExecutorSpec.xml
   <?xml version="1.0" encoding="utf-8"?>
     <automatorspec>
      <filetypes id="common">
       <ext>jpg</ext>
       <ext>png</ext>
      </filetypes>
      <filetypes id="animating">
       <ext>gif</ext>
      </filetypes>
     <filetypes id="raw">
      <ext>cr2</ext>
      <ext>nef</ext>
      <ext>crw</ext>
     </filetypes>
     <filetypes id="adobe">
      <ext>psd</ext>
      <ext>c4d</ext>
      <ext>indd</ext>
     </filetypes>
    <script name="DateInfo" path="/Users/pawan/scripts/print_date.sh" scope="CP" filetype="common">
    </script>
    <script name="ExtractMetadata" path="/Users/pawan/scripts/SysInfo.sh" scope="CP" filetype="common">
    </script>
    <script name="Notification" path="/Users/pawan/scripts/send-notification.sh" scope="CP"  filetype="common">
    </script>
    <script name="Transcoding" path="/Users/pawan/scripts/transcoding.sh" scope="CP" filetype="common">
    </script>
    <script name="Archive" path="/Users/pawan/scripts/archive.sh" scope="CP" filetype="common">
    </script>
    <script name="Automation2" path="/Users/pawan/scripts/SysInfo.sh" scope="CP" filetype="animating">
    </script>
    <script name="Automation3" path="/Users/pawan/scripts/MyTaskDetails.sh" scope="CP" filetype="adobe">
    </script>
    <script name="Automation4" path="/Users/pawan/scripts/CreateJobs.sh" scope="CP" filetype="raw">
    </script>
    <script name="Automation5" path="/Users/pawan/scripts/PublishAssets.sh" scope="CP" filetype="adobe">
    </script>
 </automatorspec>

        Script_Automator

In the above example, we have added 5 new items in the context menu for PNG file type which are executing different scripts.

Understanding the Tags in Detail :

automatorspec --> This is the main header tag of script. All tags should come under this.
  filetypes --> Use to create a single tag for the group of file
  types which need to execute a common script.
    Attributes:
      id -> Use to give id to the defined file type tag.
    Sub-Tags:
      ext -> file extension to put under filetypes tag
  script --> Tag to specify script info
    Attributes:
      name ->  Name of the context menu visible in Visual Asset
      Browser
      path  -> Script location on the disk
      scope -> Scope where the script would be executed, will default
      to CP (clientproxy)
      filetype -> Specify the filetype tag id to which script need to
      be bind. So in Asset Browser it will be visible for all the
      types present under filetype tag of specified id.
 
Sample Script with an Output file
 Script say test.sh:
      #! /bin/sh
       echo "Script Execution time is: $(date)"  >>$HOME/Desktop/args.txt
        for arg in "$@"
        do
          echo "$arg" >> $HOME/Desktop/args.txt
        done
  OutFile $HOME/Desktop/args.txt:
     Script Execution time is: Mon Nov  7 09:16:19 IST 2016
      name
      Holiday.png
      fuid
      1941

 

Leave a Comment