Color Palette Changer

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

Moderator: Moderators

TahoeLD
Posts: 1
Joined: 30 Jul 2019, 19:27

Color Palette Changer

Postby TahoeLD » 30 Jul 2019, 21:41

Hello, I have this macro that recalls a color palette then records it over another.

My first version worked great and looked like this:

Code: Select all

 <step pause="0.01">Palette.ApplyPalette("Location=Colours,2,1", false)</step>
 <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"Location=Colours,2,10")</step>
 <step pause="0.01">Palette.StoreCurrentPaletteReplace()</step>

I am now trying to use userNumbers rather than their locations in the window. I have tried changing it to this:

Code: Select all

 <step pause="0.01">Palette.ApplyPalette(userNumber:101, false)</step>
 <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"userNumber:110")</step>
 <step pause="0.01">Palette.StoreCurrentPaletteReplace()</step>

The Palette.ApplyPalette works but the ActionScript stops the macro. I have tried a bunch of different ways of quoting the second value in the ActionScript but to no avail.
I hope someone can help me figure out how to complete this! Here is the complete code for full reference:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<avolites.macros>

  <macro id="01MacRedWhite" name="01 Mac Red White">
  <description>Recall and Replace color palettes</description>
    <sequence>
     
      <step pause="0.01">ActionScript.SetProperty.Boolean("Programmer.BlindActive", true)</step>
      <step pause="0.01">Programmer.SetBlindMode(false, 0)</step>
     
      <step pause="0.01">Group.RecallGroupNumeric(101) </step>
    
     <step pause="0.01">Palette.ApplyPalette("Location=Colours,2,1", false)</step>
     <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"Location=Colours,2,10")</step>
     <step pause="0.01">Palette.StoreCurrentPaletteReplace()</step>
    
     <step pause="0.01">Palette.ApplyPalette("Location=Colours,2,2", false)</step>
     <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"Location=Colours,2,11")</step>
     <step pause="0.01">Palette.StoreCurrentPaletteReplace()</step>
    
      <step pause="0.01">Programmer.Editor.ClearAll()</step>
 
      <step pause="0.01">ActionScript.SetProperty.Boolean("Programmer.BlindActive", false)</step>
      <step pause="0.01">Programmer.SetBlindMode(false, 0)</step>
     
    </sequence>
  </macro>
</avolites.macros>


Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<avolites.macros>

  <macro id="CCMac01RedWhite" name="CC Mac 01 Red White">
  <description>Recall and Replace color palettes</description>
    <sequence>
     
      <step pause="0.01">>ActionScript.SetProperty.Boolean("Programmer.BlindActive", true)</step>
      <step pause="0.01">>Programmer.SetBlindMode(false, 0)</step>
     
      <step pause="0.01">>Group.RecallGroupNumeric(101) </step>
    
     <step pause="0.01">>Palette.ApplyPalette(userNumber:101, false)</step>
     <step pause="0.01">>ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"userNumber:110")</step>
     <step pause="0.01">>Palette.StoreCurrentPaletteReplace()</step>
    
     <step pause="0.01">>Palette.ApplyPalette(userNumber:102, false)</step>
     <step pause="0.01">>ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"userNumber:111")</step>
     <step pause="0.01">>Palette.StoreCurrentPaletteReplace()</step>
    
      <step pause="0.01">>Programmer.Editor.ClearAll()</step>
 
      <step pause="0.01">>ActionScript.SetProperty.Boolean("Programmer.BlindActive", false)</step>
      <step pause="0.01">>Programmer.SetBlindMode(false, 0)</step>
     
    </sequence>
  </macro>
</avolites.macros>
icke_siegen
Posts: 1083
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Color Palette Changer

Postby icke_siegen » 31 Jul 2019, 11:55

Hi,

the correct syntax in this case is

Code: Select all

handle:"palettehandleUN=110"


and the full threeliner is

Code: Select all

 <step pause="0.01">Palette.ApplyPalette(userNumber:101, false)</step>
 <step pause="0.01">ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"paletteHandleUN=110")</step>
 <step pause="0.01">Palette.StoreCurrentPaletteReplace()</step>


I know I yet need to write about this in the wiki :)

The reason for this syntax is: the function ActionScript.SetProperty has no idea which type of property it has to set, let alone which type of handle (you can have the same usernumber in palettes, playbacks, macros etc.). Thus in this case there is this notation which also defines the type of handle - here: paletteHandleUN - a palette handle defined by its usernumber.

Finally, if you want to do more with macros and are familiar with Slack then please drop me a PM - i have a slack group for Avo macros...

Gregory shall correct me if I wrote too much BS :)
FalkenADF01
Posts: 2
Joined: 22 Oct 2019, 13:23

Re: Color Palette Changer

Postby FalkenADF01 » 22 Oct 2019, 15:22

I can confirm that it's not BS, it works fine for me (with the corrected syntax, of course!)

Who is online

Users browsing this forum: No registered users and 3 guests