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?" | {{tag>cuelist autoload add remove}} ==== functions ==== * [[:macros:function:UserMacros.RecallMacroById]] * [[:macros:function:Playbacks.Editor.CueSelection.SelectCueByNumber]] * [[:macros:function:Playbacks.Editor.Autoload.Add]] * [[:macros:function:Playbacks.Editor.CueSelection.Clear]] * [[:macros:function:Handles.IsClaimed]] * [[:macros:function:Playbacks.Editor.Autoload.Remove]] ==== control structures ==== * [[macros:control_structures|step condition]] File with macros for cues UN 1001~1005 here: {{ :macros:example:setautoloads.xml |}} ===== Code ===== Adds autoload for cue UN 1001 to cuelist UN 10 cue 10. UserMacros.RecallMacroById("Wiki.Macros.Autoload.RemoveAutoloads.CL10C10") Playbacks.Editor.CueSelection.SelectCueByNumber("cueListHandleUN=10", 10) Playbacks.Editor.Autoload.Add("cueHandleUN=1001") Playbacks.Editor.CueSelection.Clear() Playbacks.Editor.CueSelection.SelectCueByNumber("cueListHandleUN=10", 10) Playbacks.Editor.Autoload.Remove("cueHandleUN=1001") Playbacks.Editor.Autoload.Remove("cueHandleUN=1002") Playbacks.Editor.Autoload.Remove("cueHandleUN=1003") Playbacks.Editor.Autoload.Remove("cueHandleUN=1004") Playbacks.Editor.Autoload.Remove("cueHandleUN=1005") Playbacks.Editor.CueSelection.Clear() ===== Explanation ===== This explains the functional steps within the sequence. For all the other XML details please refer to [[:macros:formats_and_syntax#xml_format|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 ===== - [[:macros:deploying|make this macro available]] - 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. ~~DISCUSSION~~