Store Palette

This is a place for people to chare the custom macros they have written.

Moderator: Moderators

User avatar
kimwida
Posts: 231
Joined: 05 Aug 2016, 16:26
Location: Seoul

Store Palette

Postby kimwida » 19 Jun 2020, 08:28

Hi, I am trying to store a palette with programmer.

Code: Select all

     <step pause="0.01">Selection.Context.Programmer.SelectFixtures("Fixtures", {1,2,3})</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(240,1,1,true,true)</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(256,1,0,true,true)</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(272,1,0,true,true)</step>
     <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteNumber",1)</step>
     <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", Handles.GetHandle("Colours",0,0))</step>
     <step pause="0.01">Palette.StoreCurrentPalette()</step>


It doesn't work. Only "Palette.StoreCurrentPaletteReplace()" works but I want to make a new palette not to replace old one.
Any help would be appreciated.
icke_siegen
Posts: 923
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Store Palette

Postby icke_siegen » 29 Jun 2020, 14:33

Hi Kim,

the following code works for me

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
  <macro id="Avolites.Macros.StorePaletteInt8" name="Store Palette Int 8">
    <description>Store Palette Int 8</description>
    <sequence>
     <step pause="0.01">Selection.Context.Programmer.SelectFixtures("Fixtures", {1,2,3})</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(240,1,1,true,true)</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(256,1,0,true,true)</step>
     <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(272,1,0,true,true)</step>
     <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteNumber", userNumber:8)</step>
     <step pause="0.01">Palette.StoreMenu.StoreOnButton("Colours", 8)</step>
     <step pause="0.01">Palette.StoreCurrentPalette()</step>
    </sequence>
  </macro>
</avolites.macros>


Explanation:

Code: Select all

ActionScript.SetProperty("Palette.CurrentPaletteNumber",1)
throws a casting error (see log collector) because the userNumber needs to be an object, not an Int. Solution: cast it with userNumber:1.

Code: Select all

ActionScript.SetProperty("Palette.CurrentPaletteHandle", Handles.GetHandle("Colours",0,0))
completely breaks the script (don't ask me why)

Code: Select all

ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"Location=Colours,0,0")
compiles but doesn't work (the palette is recorded but unassigned). I guess this would work only with a currently assigned handle.

Thus, abusing the menu helps:

Code: Select all

Palette.StoreMenu.StoreOnButton("Colours", 8)
The only problem is that this always references the current palette page. I don't know if there is a way to record a palette on an arbitrary palette page - there are some functions which simply only work with the current page. Maybe Gregory can shed more light on this.
User avatar
kimwida
Posts: 231
Joined: 05 Aug 2016, 16:26
Location: Seoul

Re: Store Palette

Postby kimwida » 30 Jun 2020, 00:57

It doesn't make color icon in a macro.
So I break it two macros and I got what I want.
Thank you.

Any you can record it any page. I got hint from Avolites-wiki.

Code: Select all

<avolites.macros>
  <macro id="MakeColor">
    <name>Make Color</name>
    <sequence>
      <step pause="0.01">Selection.Context.Programmer.SelectFixtures("Fixtures", {1,2,3})</step>
      <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(240,1,1,true,true)</step>
      <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(256,1,0,true,true)</step>
      <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(272,1,0,true,true)</step>
      <step pause="0.01">Programmer.Editor.Fixtures.SetControlValueById(274,1,0,true,true)</step>
    </sequence>
  </macro>
 
  <macro id="RecordPalette">
    <name>Record Palette</name>
    <sequence>
      <step pause="0.01">ActionScript.SetProperty("UserMacros.CurrentUserNumber", Handles.Colours.Page.Index)</step>
      <step pause="0.01">Handles.Colours.ChangePage(2)</step>
      <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteNumber",userNumber:8)</step>
      <step pause="0.01">Palette.StoreMenu.StoreOnButton("Colours", 5)</step>
      <step pause="0.01">Palette.StoreCurrentPalette()</step>
    </sequence>
  </macro>
</avolites.macros>

Who is online

Users browsing this forum: No registered users and 2 guests