Window Properties Macro

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

Moderator: Moderators

User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Window Properties Macro

Postby sideshowbond » 12 Jun 2018, 10:39

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?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 13 Jun 2018, 10:08

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")
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 13 Jun 2018, 15:08

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?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 16 Jun 2018, 00:46

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.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 17 Jun 2018, 23:53

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?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 17 Jun 2018, 23:58

Did you set the ButtonSize to Fixed?
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 18 Jun 2018, 10:53

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?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 18 Jun 2018, 11:49

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)
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 19 Jun 2018, 15:17

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?
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 20 Jun 2018, 01:33

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?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 20 Jun 2018, 14:46

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.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 20 Jun 2018, 14:55

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.
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 20 Jun 2018, 15:54

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.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: Window Properties Macro

Postby sideshowbond » 21 Jun 2018, 00:02

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
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Window Properties Macro

Postby Gregory » 21 Jun 2018, 00:10

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")

Who is online

Users browsing this forum: No registered users and 13 guests