How to create a master with a macro?

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

Moderator: Moderators

icke_siegen
Posts: 903
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

How to create a master with a macro?

Postby icke_siegen » 16 Feb 2019, 12:25

Currently trying to create a master by macro, like this:

Code: Select all

    <step>Masters.AssignMaster("FlashMaster", "Location=Playbacks,1,6")</step>


I also tried a longer version like this:

Code: Select all

    <step>Handles.SetSourceHandleFromHandle("Location=Playbacks,1,6")</step>
    <step>Masters.SetContext("FlashMaster")</step> 
    <step>Masters.AssignMaster(Masters.ContextString, Handles.SourceHandle)</step>


But neither works - the logs always show a null reference exception. Where is the fault?
User avatar
Gregory
Site Admin
Posts: 1106
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: How to create a master with a macro?

Postby Gregory » 05 Mar 2019, 23:43

In this case the handle parameter requires a handle reference which defines a location which may or may not have a handle assigned to it. As both the string notation is attempting to get an assigned handle at the specified location it returns nothing (null) if there is no handle there. There is a function to return a handle reference called Handles.CreateHandleReference which you can use:

Code: Select all

Masters.AssignMaster("FlashMaster", Handles.CreateHandleReference("Playbacks",0,0))

Who is online

Users browsing this forum: No registered users and 2 guests