I have an AppleScript which manages my home made After Effects render farm. The farm is made up of three render machines.
The script asks the user to make a selection of what machine(s) they want to render on. It takes their choice(s) and runs an external AppleScript app depending on what choice(s) they made.
Each external AppleScript app runs a command which starts an After Effects render using ExtendScript like this…
set scriptfile to (POSIX file ("/Applications/Render Farm/Scripts/jsx/render_1.jsx"))
tell application "Adobe After Effects 2020"
DoScriptFile scriptfile
end tell
The JSX file referenced above tells After Effects to start a render on Render Machine 1. The idea of the master script is that the user can select multiple render machines and start them all rendering at once.
set Options to {"Render Node 1", "Render Node 2", "Render Node 3"}
set ListA to (choose from list Options with prompt "Choose items" with title "Select Stuff" with multiple selections allowed)
if (ListA contains "Render Node 1") then
tell application "Render Node 1 App" to activate
end if
if (ListA contains "Render Node 2") then
tell application "Render Node 2 App" to activate
end if
if (ListA contains "Render Node 3") then
tell application "Render Node 3 App" to activate
end if
My script allows multiple choices to accomplish this, but I hate how sequential it is. After Effects has to receive the first AppleScript command, then run the JSX command which ssh's into the render machine, then it opens the aerender command line program multiple times per machine (each instance can take about 10-15 seconds to open). Only after the last aerender instance has opened is After Effects finally ready to listen for another AppleScript command and do it all over again for the second machine.
However, I have a different JSX command that can start a render on all render machines at the same time from within After Effects with no waiting around. I also have other ones that can start a render on Render Node 1 & 2, Render Node 1 & 3, and Render Node 2 & 3 (basically a different script for each combination.
I would like to do the same thing within my AppleScript master script. But I don't want to display a list of every possible combination, I want something that works more elegantly.
What I would like is to modify the master script so that if, for example, two selections are detected then it doesn't run two scripts, it just runs a different script.
Something like this, but with working syntax…
if (ListA contains "Render Node 1" and "Render Node 2") then
tell application "Render Node 1 & 2 App" to activate
end if
When I run that, I get the error "Can’t make "Render Node 2" into type boolean." But surely there's a way to accomplish this?
It also has to work intelligently. If I choose Render Node 1
and Render Node 3
it should ONLY open the application Render Node 1 & 3 App
. I don't want it to also open Render Node 1 App
, or Render Node 1, 2 & 3 App
.