Example ====== Patch - Park selected fixtures ====== ^ by: | Gregory Haynes, August 2019 | ^ published: | see http://forum.avolites.com/viewtopic.php?f=20&t=6207&p=22282 | ^ description: | Parks the currently selected fixtures | {{tag>park selected fixtures}} ==== functions ==== * [[:macros:function:Programmer.Editor.Selection.GetSelectedHandles]] * [[:macros:function:Handles.SetSourceHandleRangeFromHandles]] * [[:macros:function:Patch.Repatch.SetDmxAddressesFromSelectedFixture]] * [[:macros:function:Patch.Repatch.ParkSelectedFixtures]] * [[:macros:function:Handles.ClearSelection]] ==== affected properties ==== * [[:macros:property:Windows.PatchView.Handles]] * [[:macros:property:Patch.Repatch.SelectedFixtureHandles]] >The repatch menu does not actually use the PatchSelection, it has its own property Patch.Repatch.SelectedFixtureHandles. ===== Code ===== Parks the currently selected fixtures. Programmer.Editor.Selection.GetSelectedHandles("Windows.PatchView.Handles") Handles.SetSourceHandleRangeFromHandles(Windows.PatchView.Handles, true) Patch.Repatch.SetDmxAddressesFromSelectedFixture() Patch.Repatch.ParkSelectedFixtures() Handles.ClearSelection() Here, the '' pause="0.01" '' seems to be required - if there is no pause, always the previously for repatching selected fixtures will be parked, and if there aren't any an exception is thrown. ===== 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 first line retrieves the current selection and stores it in a menu property, it is not important which one just that it is the correct type. * From that we then set the source handle selection (this is the same selection that is used for copy, move, set legend etc.). * The third line copies the source handle selection to the Repatch property (and initialises other properties used in the repatch menu). * The forth line performs the Park operation and * the last line clears the source handle selection once you are done. ===== How to use it ===== * [[:macros:deploying|make this macro available]] * When needed, select some fixtures and apply this macro in order to park these fixtures. ~~DISCUSSION~~