Product icon Help book icon Sound Mill : Knowledge Base

Starting Multiple Scripts Simultaneously

Requirement

You have multiple Scripts that you want to start simultaneously. And you want to be able to control (Pause, Resume, Stop) all the Scripts with one button click. An example might be several Scripts configured as music playlists for different rooms (or zones).

Solution Summary

For this sceneario, we will assume that you have already created multiple Scripts that you need to coordinate.

  1. Create a Master Script - This will start all the other Scripts.
  2. Add Run Script Steps - to this Master Script. And each Run Script Steps needs to be configured so that they will all execute simultaneously, rather than in sequential order.

Procedure


1. Create a Master Script

  1. In the Automator (Figure 1), click the New Script button to create the master script.
  2. Select the new master Script and edit it with the Edit Script button. This pops up the Script Editor (Figure 2).
  3. Name the Script with a logical name such as "Run All Scripts".

Help Reference Link: Automator

Figure 1.  Automator
Figure 1. Automator

2. Add Run Script Steps to the Master Script

  1. In the Script Editor (Figure 2), select the 'Run Script' step item the Step Type list. Now click the Add Selected Step button.
  2. From the resulting Select Scripts dialog, select all the scripts that you want to run from the master script.
  3. The added Steps will appear in the Script Summary panel to the right of the edit controls. (Figure 2)

Help Reference Link: Script Editor

Figure 2. Script Editor
Figure 2. Script Editor

3. Configure the Steps so They Start at the Same Time

Normally, Script Steps will execute in sequential order which means that each step waits for the previous step to complete before it starts. But in this case, you want all steps in the master script to start exactly at the same time. We achieve this effect by enabling the Offset Time of each 'Run Script' step.

  1. In the Script Editor (Figure 2), select the Edit Steps button.
  2. In the resulting Manage Script Steps list dialog, select a Step, then click the Edit button. This pops up the Step Editor (Figure 3).
  3. Check the Enable Offset Time checkbox
  4. Leave the Offset Time values set to 0,0,0,0. This tells the Automator to start this step at zero (0) seconds after the containing script starts to run (effectively start the step immediately).

Repeats the above procedure for all steps contained in the master script.

Help Reference Link: Step Editor

Figure 3. Step Editor
Figure 3. Step Editor

4. Test the Master Script

Select the Master Script from the Automator window. Click the Run Script button. Then confirm that all scripts begin executing immediately and that you can control them (Pause, Resume, Stop) as a group.