Hi hope everything going well?
I’m trying to understand macro in Avolites and I to find a way to make repetitive steps in one or less steps
Ex set legend as a icon in 10 singles macros
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
<macro name="Set Icon as Legend for Specific Macros" id="Macros.SetLegend.Specific">
<description>This macro sets an icon as a legend for specific macros using a loop.</description>
<sequence>
<!-- Define the list of macro IDs -->
<variable name="macroIDs" type="List`1" value="1, 11, 23, 38, 45" />
<!-- Loop through each macro ID -->
<loop source="macroID" target="macroIDs">
<sequence>
<!-- Set the source handle for the current macro ID -->
<step>Handles.SetSourceHandle("Macros", $macroID$ - 1)</step>
<!-- Store icon and set as legend for the current macro ID -->
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
</sequence>
</loop>
</sequence>
</macro>
</avolites.macros>
If this function exists in XML I hope work on Avoites ?
Is possible usse the loop function in XML macros
Moderator: Moderators
-
- Posts: 6
- Joined: 16 Nov 2019, 22:14
- Location: Lisboa
- Contact:
how to target a many objects?
hi i have a question about xml macros ( the loop in xml is tool for target more the one (handle; macro etc) is possible to usse in Avolites ?
i have this one !
and i like this is possible?
i ask for a way to make the macro with a better performance( by step in Avolites delay all promps) and take time change a icon to 30 macro ? is not possible make in one go? thanks
i have this one !
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
<macro name="Set Icon as Legend for Specific Macros" id="Macros.SetLegend.Specific">
<description>This macro sets an icon as a legend for specific macros.</description>
<sequence>
<!-- Set the source handle for specific macros -->
<step>Handles.SetSourceHandle("Macros", 0)</step>
<!-- Store icon and set as legend for Macro 1 -->
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
<!-- Store icon and set as legend for Macro 11 -->
<step>Handles.SetSourceHandle("Macros", 10)</step>
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
<!-- Store icon and set as legend for Macro 23 -->
<step>Handles.SetSourceHandle("Macros", 22)</step>
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
<!-- Store icon and set as legend for Macro 38 -->
<step>Handles.SetSourceHandle("Macros", 37)</step>
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
<!-- Store icon and set as legend for Macro 45 -->
<step>Handles.SetSourceHandle("Macros", 44)</step>
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
</sequence>
</macro>
</avolites.macros>
and i like this is possible?
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
<macro name="Set Icon as Legend for Specific Macros" id="Macros.SetLegend.Specific">
<description>This macro sets an icon as a legend for specific macros using a loop.</description>
<sequence>
<!-- Define the list of macro IDs -->
<variable name="macroIDs" type="List`1" value="1, 11, 23, 38, 45" />
<!-- Loop through each macro ID -->
<loop source="macroID" target="macroIDs">
<sequence>
<!-- Set the source handle for the current macro ID -->
<step>Handles.SetSourceHandle("Macros", $macroID$ - 1)</step>
<!-- Store icon and set as legend for the current macro ID -->
<step>Icons.StoreIcon("1caf5766-67e1-41a0-aec4-dc821f1c160a", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIcon(Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>Handles.ClearSelection()</step>
</sequence>
</loop>
</sequence>
</macro>
</avolites.macros>
i ask for a way to make the macro with a better performance( by step in Avolites delay all promps) and take time change a icon to 30 macro ? is not possible make in one go? thanks
Re: Is possible usse the loop function in XML macros
In short no, macros do not have any syntax for performing loops. The closest would be to run the same macro multiple times by calling the UserMacros.LoopMacro function and incrementing a counter:
In your specific example it is possible to set the same icon to multiple handles in one go using either the Handles.SetIconForHandles, Handles.SetSourceHandleRangeFromHandles or Handles.SetSourceHandleRange:
In all of these examples there were five empty groups (user numbers 1 through 5) recorded to the first five buttons in the Groups window. Please update the icon and Titan IDs as required.
Code: Select all
<macro id="Macros.SetLegend.Specific.Start" name="Set Icon Start">
<description>Set the start value to 1 and run the Loop macro 4 times.</description>
<sequence>
<step>ActionScript.SetProperty.Integer("Macros.SetLegend.Specific.Loop.i", 1)</step>
<step>UserMacros.LoopMacro(UserMacros.GetMacroHandleFromId("Macros.SetLegend.Specific.Loop"), 4)</step>
</sequence>
</macro>
<macro id="Macros.SetLegend.Specific.Loop" name="Set Icon Loop">
<description>This macro gets run several times by the Start macro.</description>
<variables>
<integer id="i" value="1"/>
</variables>
<sequence>
<step>Icons.StoreIcon("90e4661d-e8ff-475e-bc69-d8c7e43a5eca", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIconForHandles(Handles.GetHandleFromUserNumber("groupHandle", Macros.SetLegend.Specific.Loop.i), Expert.Legend.Set.Generic.PendingTitanId)</step>
<step>ActionScript.SetProperty.Integer("Macros.SetLegend.Specific.Loop.i", Macros.SetLegend.Specific.Loop.i + 1)</step>
</sequence>
</macro>
In your specific example it is possible to set the same icon to multiple handles in one go using either the Handles.SetIconForHandles, Handles.SetSourceHandleRangeFromHandles or Handles.SetSourceHandleRange:
Code: Select all
<macro id="Macros.SetLegend.Specific.1" name="Set Icon 1">
<description>Set icons for multiple handles using string notation to identify handle.</description>
<sequence>
<step>Icons.StoreIcon("90e4661d-e8ff-475e-bc69-d8c7e43a5eca", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIconForHandles("{groupHandleUN=1,groupHandleUN=3,groupHandleUN=4,groupHandleUN=5}", Expert.Legend.Set.Generic.PendingTitanId)</step>
</sequence>
</macro>
<macro id="Macros.SetLegend.Specific.2" name="Set Icon 2">
<description>Select multiple handles by location (group and index).</description>
<sequence>
<step>Handles.SetSourceHandleRange("Groups", {0, 1, 3, 4})</step>
<!-- The following only works if the icon is already present in the show file -->
<step>Handles.SetIconsOrLegends("90e4661d-e8ff-475e-bc69-d8c7e43a5eca", "")</step>
<step>Handles.ClearSelection()</step>
</sequence>
</macro>
<macro id="Macros.SetLegend.Specific.3" name="Set Icon 3">
<description>Set icons for handles using their internal Titan IDs.</description>
<sequence>
<step>Icons.StoreIcon("90e4661d-e8ff-475e-bc69-d8c7e43a5eca", "Expert.Legend.Set.Generic.PendingTitanId")</step>
<step>Handles.SetIconForHandles({ 1821, 1822, 1823, 1825 }, Expert.Legend.Set.Generic.PendingTitanId)</step>
</sequence>
</macro>
In all of these examples there were five empty groups (user numbers 1 through 5) recorded to the first five buttons in the Groups window. Please update the icon and Titan IDs as required.
Who is online
Users browsing this forum: No registered users and 7 guests