Example ====== Macro - Copy Macro by MacroId ====== ^ by: | Gregory Haynes, August 2018 | ^ published: | ./. | ^ description: | copy a macro, identifying it by its macroId. | ^ remarks: | Best used together with setup/initialize macros, e.g. [[macros:example:createworkspaces|]] | Original idea/request by Alex del Bondio, see http://forum.avolites.com/viewtopic.php?f=20&t=5780. The main problem when attempting to copy items from the show library is that imported items don't have a dedicated handle - the items from an imported show are displayed dynamically. Hence a way needs to be found how to address an item by other means - in the case of macros: their Id. {{tag>copy import macro id macroid}} ==== functions ==== * [[:macros:function:Playbacks.Editor.Macros.SetTargetHandle]] * [[:macros:function:ActionScript.SetProperty.Enum]] * [[:macros:function:Handles.SetSourceHandleFromHandle]] * [[:macros:function:Handles.CopyDestination]] ==== affected properties ==== * [[:macros:property:Handles.OperationMode]] * [[:macros:property:Playbacks.Editor.Macros.Target.Handle]] ===== Code ===== Playbacks.Editor.Macros.SetTargetHandle("Avolites.Macros.SnapForward") ActionScript.SetProperty.Enum("Handles.OperationMode", "move") Handles.SetSourceHandleFromHandle(Playbacks.Editor.Macros.Target.Handle) Handles.CopyDestination("Fixtures", 0) ===== 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]] >The ''SetTargetHandle'' call uses the macro ID string to get the handle associated with the macro (even if it is an unassigned factory macro) and assigns that handle to the ''Playbacks.Editor.Macros.Target.Handle'' property. This property can then be passed into any other function that requires a handle such as the ''SetSourceHandleFromHandle'' function. ===== How to use it ===== * [[:macros:deploying|make this macro available]] * this macro is best used together with other setup macros to copy your preferred macros to locations of your liking ~~DISCUSSION~~