Page 1 of 2

Window Properties Macro

Posted: 12 Jun 2018, 10:39
by sideshowbond
I am trying to set window properties for the playbacks workspace in a macro. More specifically I am trying to set rows & columns. I tried

Code: Select all

ActionScript.SetProperty.Int32("Windows.Playbacks.FixedColumns", 5)

as I have similar macros controlling Display Options in Channel Grid. Didn't do it though. Any ideas?

Re: Window Properties Macro

Posted: 13 Jun 2018, 10:08
by Gregory
I did:

Code: Select all

ActionScript.SetProperty("Windows.Playbacks.FixedColumns", 5)

Or:

Code: Select all

ActionScript.SetProperty.Integer("Windows.Playbacks.FixedColumns", 5)

Both of which work. Also to set the the view to use custom sizes I did:

Code: Select all

ActionScript.SetProperty.Enum("Windows.Playbacks.ButtonSize", "Fixed")

Re: Window Properties Macro

Posted: 13 Jun 2018, 15:08
by sideshowbond
brilliant, thanks Greg.

Just to be sure: you haven't specified a data type in your first and you have in your last example. Do I or do I not need to?

Re: Window Properties Macro

Posted: 16 Jun 2018, 00:46
by Gregory
The ActionScript.SetProperty function can be used to set a value of any type, as the parameter type Object is the root class for all types including non-reference types (e.g. integers, floats). The ActionScript.SetProperty.Integer function only accepts an integer as the second parameter which can have the advantage when parsing input this can be assumed and so the correct type is chosen (particularly in WebAPI). However you can force a conversion by using casts which can work where automatic conversion is not possible for example:

Code: Select all

ActionScript.SetProperty("Windows.Playbacks.FixedColumns", int:"5")
will work where

Code: Select all

ActionScript.SetProperty.Integer("Windows.Playbacks.FixedColumns", "5")
will not.

The ActionScript.SetProperty.Enum function takes a string as the value parameter and internally converts that string to the correct enumeration type based on the current value of the property being set. WebAPI does something similar when initially parsing values but uses the function parameter type to determine this however as there are many enumeration types there is not a SetProperty function for each one as this would be impractical. You could do the following:

Code: Select all

ActionScript.SetProperty("Windows.Playbacks.ButtonSize", Math.ToEnum("Avolites.Titan.Controllers", "Avolites.Titan.Controllers.HandleButtonSize", "Fixed"))
but that is very long-winded in comparison to the ActionScript.SetProperty.Enum function.

Re: Window Properties Macro

Posted: 17 Jun 2018, 23:53
by sideshowbond
just had the time to play again and it seems the macro only works when columns have been set to a number before. When it's set to dynamic the macro doesn't seem to have any effect. Is there a way around that?

Re: Window Properties Macro

Posted: 17 Jun 2018, 23:58
by Gregory
Did you set the ButtonSize to Fixed?

Re: Window Properties Macro

Posted: 18 Jun 2018, 10:53
by sideshowbond
now i did. Seems I missed that bit.

Another question: I am trying to record a workspace via macro specifying user number and location at the same time. Possible?

Re: Window Properties Macro

Posted: 18 Jun 2018, 11:49
by Gregory
No, not at the same time. You could record the workspace to a handle and then set the user number afterwards e.g.:

Code: Select all

Workspace.Record(Handles.CreateHandleReference("Workspaces", 0, 4), "My Workspace", 0, true, false)
ActionScript.SetProperty("Handles.AllowEditWorkspaces", true)
Handles.SetSourceHandle("Workspaces", 4)
ActionScript.SetProperty("Handles.CurrentUserNumber", userNumber:20)
Handles.SetUserNumber()
Handles.ClearSelection()
ActionScript.SetProperty("Handles.AllowEditWorkspaces", false)

Re: Window Properties Macro

Posted: 19 Jun 2018, 15:17
by sideshowbond
Brilliant, this works great. Thanks a lot!

You might have guessed it by now but I am coding a macro that opens and records my workspaces as you can still not import them... pretty sure there will be more questions along the way.

One thing I was wondering: does

Code: Select all

Windows.SetWindowRegion("Windows.Playbacks", "secondary")

work by now?

Re: Window Properties Macro

Posted: 20 Jun 2018, 01:33
by sideshowbond
also I got

Code: Select all

      <step pause="0.001"><menuLink id="Windows.ShowLibrary" stack="mainWindowStack" behaviour="PushOrRaise" maximised="false" regionId="secondary" /></step>
      <step>Windows.SetWindowProperty.X("Windows.ShowLibrary", 0)</step>
      <step>Windows.SetWindowProperty.Y("Windows.ShowLibrary", 0)</step>
      <step>Windows.SetWindowProperty.Width("Windows.ShowLibrary", 1.833)</step>
      <step>Windows.SetWindowProperty.Height("Windows.ShowLibrary", 2)</step>
      <step>Windows.SetWindowProperty.X("Windows.ShowLibrary", 0)</step>
      <step>Windows.SetWindowProperty.Y("Windows.ShowLibrary", 0)</step>
      <step>ActionScript.SetProperty.Enum("Windows.ShowLibrary.HandleDisplayMode", "All")</step>      
      <step>ActionScript.SetProperty.Enum("Windows.ShowLibrary.DisplayLibraryMode", "ItemsGrid")</step>
      <step pause="0.001">ActionScript.SetProperty.String("Windows.ShowLibrary.FilterText","")</step>

but it doesn't set width and height when the window has manually been maximised before. Is there something like a WindowSize that can be set?

Re: Window Properties Macro

Posted: 20 Jun 2018, 14:46
by Gregory
There has been no change to the Windows.SetWindowRegion function so it is still not available.

The window dimensions (X, Y, Width and Height) only apply to the window when it is not maximised. You can still set the dimensions while the window is maximised and these will be used when you press the Min/Max button to restore the original size. You can use the following code to restore/minimise the currently active window:

Code: Select all

Windows.Stack.MaximiseWindow("mainWindowStack")
Windows.Stack.MinMaxWindow("mainWindowStack")
This sets the window to maximised first and then toggles the setting.

Re: Window Properties Macro

Posted: 20 Jun 2018, 14:55
by sideshowbond
great thanks.

Shame about the regionId. Is there a similar way like MaximiseWindow and then cycle the region?

Also I am trying to implement verticalScrollOffset. How would I go on about that. I tried a couple of options and none seem to work.

Re: Window Properties Macro

Posted: 20 Jun 2018, 15:54
by Gregory
You could either use the Windows.Scrolling.Vertical.LineUp function (see factory macros for that and other examples) or use Windows.Scrolling.Vertical.Scroll which works in pixels. However in all these cases the values are relative to the current scroll position but you could do something like:

Code: Select all

Windows.Scrolling.Vertical.Scroll(-100000)
Windows.Scrolling.Vertical.Scroll(10)
To be fairly sure that you are 10 pixels from the top, regardless of your starting position.

Re: Window Properties Macro

Posted: 21 Jun 2018, 00:02
by sideshowbond
thought about something like that :)

Isn't there any workaround you can think of to set regionId? Not being able to at all does make me wonder

Re: Window Properties Macro

Posted: 21 Jun 2018, 00:10
by Gregory
Apart from the CycleActiveWindowRegion function I don't think there is another way to set the current region of a window e.g.:

Code: Select all

Windows.Stack.CycleActiveWindowRegion("mainWindowStack")