Playback User Number

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

Moderator: Moderators

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

Playback User Number

Postby icke_siegen » 21 Jun 2018, 13:22

I want to store a playback with a particular usernumber. As this isn't possible I go for storing at a specific location and then changing the user number. However this fails, with various casting errors. I try

Code: Select all

Playbacks.StoreCue("PlaybackWindow", 1000, false);
Handles.SetSourceHandle("PlaybackWindow", 1000);
ActionScript.SetProperty("Handles.CurrentUserNumber", 10000);  <== this is probably where the error is
Handles.ValidateCurrentUserNumber();
Handles.SetSourceHandleFromHandle(null);


Also I want this to check if this playback already exists, and do a ReplacePlaybackCue instead. However, my condion seems to be faulty. I do:

Code: Select all

{
   if(Playbacks.IsCueHandle(userNumber:10000)){
      Playbacks.ReplacePlaybackCue(userNumber:10000, false);
   } else {
      (see above)
   }
}


Can someone please point me in the right direction? Thanks
User avatar
Gregory
Posts: 1301
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Playback User Number

Postby Gregory » 21 Jun 2018, 14:09

You need to cast the user number value to the correct type and call the SetUserNumber function, I also used the ClearSelection function to tidy up afterwards:

Code: Select all

Playbacks.StoreCue("PlaybackWindow", 1000, false);
Handles.SetSourceHandle("PlaybackWindow", 1000);
ActionScript.SetProperty("Handles.CurrentUserNumber", userNumber:10000);
Handles.SetUserNumber();
Handles.ClearSelection();

The condition looks okay from what I can see, is there any error reported?
icke_siegen
Posts: 1088
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Playback User Number

Postby icke_siegen » 21 Jun 2018, 14:58

Thanks for the quick answer. However, the line

Code: Select all

ActionScript.SetProperty("Handles.CurrentUserNumber", userNumber:10000);


still doesn't work - the logs state a NullReferenceException.
User avatar
Gregory
Posts: 1301
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Playback User Number

Postby Gregory » 21 Jun 2018, 16:09

I tried running the code before I posted it and it seemed to work for me. Can you try running this in a new show if you haven't already? If that is still not successful perhaps post the stack trace for the NullReferenceException.
icke_siegen
Posts: 1088
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Playback User Number

Postby icke_siegen » 21 Jun 2018, 17:21

I started over again - new show, and made the macros anew.

If I do the macro step by step then it works, like this:

Code: Select all

<sequence>
     <step>Playbacks.SetRecordType("RecordCueModeProgrammer")</step>
     <step>Playbacks.StoreCue("PlaybackWindow", 1000, false)</step>
     <step>Handles.SetSourceHandle("PlaybackWindow", 1000)</step>
     <step>ActionScript.SetProperty("Handles.CurrentUserNumber", userNumber:10000)</step>
     <step>Handles.SetUserNumber()</step>
     <step>Handles.ClearSelection()</step>
</sequence>


However, if I try to do this in one step (because I want to apply a condition) then I get the error. I try

Code: Select all

<sequence>
     <step>Playbacks.SetRecordType("RecordCueModeProgrammer")</step>
     <step>
         {
            Playbacks.StoreCue("PlaybackWindow", 1000, false);
            Handles.SetSourceHandle("PlaybackWindow", 1000);
            ActionScript.SetProperty("Handles.CurrentUserNumber", userNumber:10000);
            Handles.SetUserNumber();
            Handles.ClearSelection();
         }
     </step>
</sequence>


exception stack trace:

Code: Select all

  bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   bei System.Delegate.DynamicInvokeImpl(Object[] args)
   bei Avolites.General.Utilities.InvokeQueue`1.OnItemOut(InvokeQueueItem`1 item)
   bei Avolites.General.Utilities.WorkQueue`1.ProcessQueue()


inner eexception stack trace:

Code: Select all

   bei Avolites.Menus.ScriptExecutor.GetActionIdFromScript(String script)
   bei Avolites.Menus.ScriptExecutor.GetScript(String id)
   bei Avolites.Menus.ActionScriptParser.CastedParameterExpression.Execute(IExecutionContext context, Boolean debug)
   bei Avolites.Menus.ActionScriptParser.ActionScriptFunctionExpression.Execute(IExecutionContext context, Boolean debug)
   bei Avolites.Menus.ActionScriptParser.Expressions.BlockExpression.Execute(IExecutionContext context, Boolean debug)
   bei Avolites.Menus.ScriptExecutor.Run(MenuAction action, Nullable`1 eventFilter, Boolean strictMode, ActionParameter[] parameters)
   bei Avolites.Menus.Macros.Macro.Run(Int32 count, MacroSection section, ActionParameter[] localVariables)


Is it a runtime/race condition thing?
User avatar
Gregory
Posts: 1301
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Playback User Number

Postby Gregory » 21 Jun 2018, 20:15

It appears that you cannot use the cast operator within a statement block. It tries to get the function being called but cannot find it inside the statement block.

Who is online

Users browsing this forum: No registered users and 7 guests