User Tools

Site Tools


macros:example:addautoloads

Example

Add/Remove Autoloads

by: Sebastian Beutel, August 2024
published: here
description: add/remove autoloads to/from a cuelist cue.
remarks: idea Sebastiaan Groen, https://www.facebook.com/groups/1811437589141428/posts/3826930897592077/: “is it possible to add and remove an autoload from a cuelist via a macro?”

functions

control structures

File with macros for cues UN 1001~1005 here: setautoloads.xml

Code

filename.xml
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
 
  <macro id="Wiki.Macros.Autoload.Add.CL10C10.1001" name="Add AL CL10C10 1001">
    <description>Adds autoload for cue UN 1001 to cuelist UN 10 cue 10.</description>
    <sequence>
      <step>UserMacros.RecallMacroById("Wiki.Macros.Autoload.RemoveAutoloads.CL10C10")</step>
      <step>Playbacks.Editor.CueSelection.SelectCueByNumber("cueListHandleUN=10", 10)</step>
      <step>Playbacks.Editor.Autoload.Add("cueHandleUN=1001")</step> 
      <step>Playbacks.Editor.CueSelection.Clear()</step>
    </sequence>
  </macro>
 
<!-- add more macros here for more autoloads -->
 
  <macro id="Wiki.Macros.Autoload.RemoveAutoloads.CL10C10" name="Remove Autoloads from CL 10 C10">
    <sequence>
      <step>Playbacks.Editor.CueSelection.SelectCueByNumber("cueListHandleUN=10", 10)</step>
      <step condition="Handles.IsClaimed('cueHandleUN=1001')">Playbacks.Editor.Autoload.Remove("cueHandleUN=1001")</step> 
      <step condition="Handles.IsClaimed('cueHandleUN=1002')">Playbacks.Editor.Autoload.Remove("cueHandleUN=1002")</step> 
      <step condition="Handles.IsClaimed('cueHandleUN=1003')">Playbacks.Editor.Autoload.Remove("cueHandleUN=1003")</step> 
      <step condition="Handles.IsClaimed('cueHandleUN=1004')">Playbacks.Editor.Autoload.Remove("cueHandleUN=1004")</step> 
      <step condition="Handles.IsClaimed('cueHandleUN=1005')">Playbacks.Editor.Autoload.Remove("cueHandleUN=1005")</step>
      <step>Playbacks.Editor.CueSelection.Clear()</step>
    </sequence>
  </macro>
 
</avolites.macros>

Explanation

This explains the functional steps within the sequence. For all the other XML details please refer to Formats and syntax

  • before setting a new autoload existing autoloads are removed by calling the 'remove' macro with UserMacros.RecallMacroById(“Wiki.Macros.Autoload.RemoveAutoloads.CL10C10”)
  • then the cuelist cue where the autoload is going to be added to is called with Playbacks.Editor.CueSelection.SelectCueByNumber(“cueListHandleUN=10”, 10)
  • now the autoload is set with Playbacks.Editor.Autoload.Add(“cueHandleUN=1001”)
  • finally Playbacks.Editor.CueSelection.Clear() unselects the cuelist cue
  • the remove macro works likewise. However, in order to prevent it from breaking if an autoload is set to a nonexisting handle, Handle.IsClaimed is used as step condition

How to use it

  1. as most macros this relies on defining with which handles it should work with. The example given sets the autoload target by usernumber 1001 in cuelist usernumber 10, cue 10. Hence, either make sure to use the correct usernumbers, or change the macro as you need.
You could leave a comment if you were logged in.
macros/example/addautoloads.txt · Last modified: 2024/08/08 09:38 by icke_siegen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki