Question about macros

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

Moderator: Moderators

Michiel3000
Posts: 31
Joined: 04 Oct 2015, 13:17

Question about macros

Postby Michiel3000 » 23 Jan 2019, 12:46

Hi all,

I'm new into making my own macros and having some troubles to start.
I want to make a macro to create palettes for my fixtures. I have 3 groups of fixtures. Two of those groups are blue for example, one group is red. The code I have currently written:

Code: Select all

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

<macro id = "userMacro.createPalleteTest">
   <name>Create Multi Color Pallete Test</name>
   <sequence>
      <step pause = "0.001"> Group.RecallGroupNumeric(100)</step>
      <step pause = "0.001"> Palette.ApplyPalette("Location=Colours,2,100", false)</step>
      <step pause = "0.001"> Group.RecallGroupNumeric(101)</step>
      <step pause = "0.001"> Palette.ApplyPalette("Location=Colours,2,100", false)</step>
      <step pause = "0.001"> Group.RecallGroupNumeric(102)</step>
      <step pause = "0.001"> Palette.ApplyPalette("Location=Colours,2,101", false)</step>
      <step pause = "0.001"> Group.RecallGroupNumeric(100)</step>
      <step pause = "0.001"> Group.RecallGroupNumeric(101)</step>
      <step pause = "0.001"> Group.RecallGroupNumeric(102)</step>
      <step pause = "0.001"> Palette.ReplacePalette(113)</step>
   </sequence>
</macro>
</avolites.macros>


What (I think) it should do: select first group, apply blue colour palette. Select second group, apply blue palette. Select third group, apply red palette. Select all three groups and then it should store the created palette into the colour window workspace (replace palette with user number 113).

My question: When I try to run this macro, I can see the first group of fixtures is selected but no color information is in the programmer, so I assume the macro stops after the first step, but why?

All groups and palette information used, should be correct. (In the attachments is a screen shot of the titan interface, so you can verify the group/colour usernumbers)
Knipsel.PNG
Knipsel.PNG (112.61 KiB) Viewed 8081 times


Thanks in advance,
Michiel
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Question about macros

Postby sideshowbond » 23 Jan 2019, 16:06

Your macro tries to reference to the actual location of the handle. In this case that would be page 2/handle 2 for your red palette

Code: Select all

Palette.ApplyPalette("Location=Colours,2,2", false)</step>


If you want to refer to user numbers you can use

Code: Select all

Palette.ApplyPalette("paletteHandleUN=100", false)


In theory you shouldn't have to reselect all the groups as the information is in the programmer anyways.

Also I would consider a clear command at the beginning and the end of the macro.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Question about macros

Postby sideshowbond » 23 Jan 2019, 22:13

try this

Code: Select all

      <sequence>
         <step>Programmer.Editor.ClearAll()</step>
         <step>Group.RecallGroupNumeric(101)</step>
         <step>Palette.ApplyPalette("paletteHandleUN=100", false)</step>
         <step>Group.RecallGroupNumeric(102)</step>
         <step>Palette.ApplyPalette("paletteHandleUN=100", false)</step>
         <step>Group.RecallGroupNumeric(103)</step>
         <step>Palette.ApplyPalette("paletteHandleUN=101", false)</step>
         <step>ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"paletteHandleUN=113")</step>
         <step>Palette.StoreCurrentPaletteReplace()</step>
         <step>Programmer.Editor.ClearAll()</step>
      </sequence>


Precondition: there is a palette 113 already existing.
Michiel3000
Posts: 31
Joined: 04 Oct 2015, 13:17

Re: Question about macros

Postby Michiel3000 » 24 Jan 2019, 12:23

Thanks for your reply, tried it out and the macro runs and records a palette. However, when I recall the palette it turns all fixtures (all 3 groups) red, what could cause this?

To understand this step:

Code: Select all

         <step>ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"paletteHandleUN=113")</step>


It selects the palette with user number 113 without applying any of it's information in the programmer, to overwrite whatever is in the programmer on this palette in the next step, right?
Does this function have other applications to?
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Question about macros

Postby sideshowbond » 24 Jan 2019, 14:09

Have you checked the content of the palette (View/Open + Palette). I haven't checked the output in Capture but the content looked as expected.

Yes,

Code: Select all

<step>ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"paletteHandleUN=113")</step>
is to set the current palette aka select the palette. Like hitting the palette button where you are able to enter a number which is basically the same. As far as I know this is needed for every operation that handles CurrentPalette. Same with groups, macros and probably a couple more.
Michiel3000
Posts: 31
Joined: 04 Oct 2015, 13:17

Re: Question about macros

Postby Michiel3000 » 24 Jan 2019, 15:44

Alright, now this step makes sense, thanks a lot!

I checked the content of the palette, it contains only the fixturs of the first group (usernumber 100). Color information is red.
Knipsel.PNG
Knipsel.PNG (60.79 KiB) Viewed 8042 times
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Question about macros

Postby sideshowbond » 24 Jan 2019, 16:26

It doesn't contain any fixtures as such, only fixture types as it is a shared palette. It needs to be a normal palette for this to work.
Michiel3000
Posts: 31
Joined: 04 Oct 2015, 13:17

Re: Question about macros

Postby Michiel3000 » 24 Jan 2019, 16:53

I added again 3 steps to select all 3 groups before recording the palette. Now it records a normal palette with the right fixture information. Thanks for helping me out!

Who is online

Users browsing this forum: No registered users and 12 guests