Create Groups Macro

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

Moderator: Moderators

lopesmacp
Posts: 17
Joined: 13 Oct 2016, 15:01

Create Groups Macro

Postby lopesmacp » 15 Jul 2023, 21:50

So i wanted to create a macro that would create a few auto groups. Since i dont understand much about coding, i tried to ask chat GPT to make me one. This is what i got:

Code: Select all

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

  <macro id="CreateFixtureGroups" name="Create and Record Fixture Groups">
    <sequence>
      <!-- Step 1: Read the selected fixtures -->
      <step>Fixture.SelectAll()</step>

      <!-- Step 2: Locate any free handles on Groups window -->
      <step>Groups.UnselectAll()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle1")</step>

      <!-- Step 3: Record the "All" group -->
      <step>Fixture.SelectAll()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle1")</step>

      <!-- Step 3: Record the "Odd" group -->
      <step>Fixture.FilterBy.Odd()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle2")</step>

      <!-- Step 3: Record the "Even" group -->
      <step>Fixture.FilterBy.Even()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle3")</step>

      <!-- Step 3: Record the "Left" group -->
      <step>Fixture.FilterBy.Left()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle4")</step>

      <!-- Step 3: Record the "Right" group -->
      <step>Fixture.FilterBy.Right()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle5")</step>

      <!-- Step 3: Record the "Center" group -->
      <step>Fixture.FilterBy.Center()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle6")</step>

      <!-- Step 3: Record the "Out" group -->
      <step>Fixture.FilterBy.Out()</step>
      <step>Groups.RecordSelected(handle: "GroupHandle7")</step>
    </sequence>
  </macro>

</avolites.macros>


The objective was to use the selected fixtures to create groups based on the selection.

All would create a group with all selected
Left would assume only the left half of the selection
and so on.

It would seatch for a free handle and record it there.

I shows this to sebastian, and he told me, lots of functions here dont really work.

How much of this is wrong? Probably 90% of it, no? Could someone create a working macro for this?
User avatar
kimwida
Posts: 250
Joined: 05 Aug 2016, 16:26
Location: Seoul

Re: Create Groups Macro

Postby kimwida » 21 Jul 2023, 04:26

This one is what I made long before. It will be help to you.

Code: Select all

<step pause="0.05">Selection.Context.Programmer.SelectFixtures("Fixtures", {1,2,3,4,5,6,7,8})</step>
<step pause="0.05">Handles.Groups.ChangePage(0)</step>
<step pause="0.05">Group.StoreMenu.StoreOnButton("Groups", 0, userNumber:201)</step>
<step pause="0.05">Programmer.Editor.ClearAll()</step>
<step pause="0.05">Handles.SetSourceHandleFromHandle(Handles.GetHandle("Groups",0,0)) </step>
<step pause="0.05">ActionScript.SetProperty.Enum("Handles.SourceHandle.LockState","Unlocked")</step>
<step pause="0.05">Handles.SetLockState(Handles.SourceHandle.LockState)</step>
<step pause="0.05">ActionScript.SetProperty("Handles.PendingLegend","Up ----")</step>
<step pause="0.05">Handles.SetLegend()</step>
<step pause="0.05">Handles.ClearSelection()</step>
<step pause="0.05">Programmer.Editor.ClearAll()</step>
lopesmacp
Posts: 17
Joined: 13 Oct 2016, 15:01

Re: Create Groups Macro

Postby lopesmacp » 25 Jul 2023, 10:30

thanks for your reply.
Can you explain how it works?

Who is online

Users browsing this forum: No registered users and 60 guests