Example ====== Off/On Attribute in Palette ====== ^ by: | Alex del Bondio, November 2018 | ^ published: | http://forum.avolites.com/viewtopic.php?f=20&t=5928 | ^ description: | macro to turn an attribute group off resp. on in a palette | ^ remarks: | Idea/request by PascalvE | {{tag>off on attribute group palette}} This macro assumes that group 999 and palette 999 exist. Group 999 is used as temporary store for the selected fixtures. The macro turns colour values in palette 999 off resp. on. There is a follow-up thread in the forum explaining how this can be done entirely with coded functions: http://forum.avolites.com/viewtopic.php?f=20&t=5936 This has been reproduced in this wiki here: [[macros:example:offonattribute|]] ==== functions ==== * [[:macros:function:Group.ReplaceGroupOnHandle]] * [[:macros:function:ActionScript.SetProperty.Boolean]] * [[:macros:function:Programmer.SetBlindMode]] * [[:macros:function:Group.RecallGroup]] * [[:macros:function:Menu.Stack.PushOrReloadMenu]] * [[:macros:function:Menu.InjectInput]] * [[:macros:function:Palette.QuickMergePalette]] * [[:macros:function:Programmer.Editor.Clear]] ==== affected properties ==== * [[:macros:property:Programmer.BlindActive]] ===== Code ===== Group.ReplaceGroupOnHandle(userNumber: 999) ActionScript.SetProperty.Boolean("Programmer.BlindActive", true) Programmer.SetBlindMode(false, 0) Group.RecallGroup(userNumber: 999) Menu.Stack.PushOrReloadMenu("Primary", "Expert.Root.Program") Menu.InjectInput("OnSelect","AttributeGroup","NoGroup",4) Menu.InjectInput("OnButtonDown","Off","",0) Menu.InjectInput("OnButtonUp","Off","",0) Menu.InjectInput("OnSelect","Softkey","NoGroup",2) Palette.QuickMergePalette(userNumber: 999) Programmer.Editor.Clear(All, true, false, 0) ActionScript.SetProperty.Boolean("Programmer.BlindActive", false) Programmer.SetBlindMode(false, 0) Group.ReplaceGroupOnHandle(userNumber: 999) ActionScript.SetProperty.Boolean("Programmer.BlindActive", true) Programmer.SetBlindMode(false, 0) Group.RecallGroup(userNumber: 999) Menu.Stack.PushOrReloadMenu("Primary", "Expert.Root.Program") Menu.InjectInput("OnSelect","AttributeGroup","NoGroup",4) Menu.InjectInput("OnButtonDown","Off","",0) Menu.InjectInput("OnButtonUp","Off","",0) Menu.InjectInput("OnButtonDown","Off","",0) Menu.InjectInput("OnButtonUp","Off","",0) Menu.InjectInput("OnSelect","Softkey","NoGroup",2) Palette.QuickMergePalette(userNumber: 999) Programmer.Editor.Clear(All, true, false, 0) ActionScript.SetProperty.Boolean("Programmer.BlindActive", false) Programmer.SetBlindMode(false, 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]] This macro assumes that group 999 and palette 999 exist. Group 999 is used as temporary store for the selected fixtures. The macro turns colour values in palette 999 off resp. on. * ''Group.ReplaceGroupOnHandle'' puts the currently selected fixtures into a group as temporary store * then, blind mode is entered - see [[macros:example:blindmodeonoff|]] * ''Group.RecallGroup'' recalls the previously selected fixtures from the temp. store * the next commands are taken from a recorded macro: * ''Menu.Stack.PushOrReloadMenu'' makes sure we are in the root menu * ''Menu.InjectInput'' are the recorded key presses: * ''[C]'' (colour) * '''' (in the second macro is pressed twice which makes it toggle to On) * ''[Attribute Off]'' * ''Palette.QuickMergePalette'' merges the off/on value into the palette * ''Programmer.Editor.Clear'' clears the programmre * finally the blind mode is being exited from ===== How to use it ===== * [[:macros:deploying|make this macro available]] * make sure group 999 and palette 999 exist and suit your needs or adapt the macro * fire the macro to turn colour off resp. on in this palette ~~DISCUSSION~~