Old 12-31-2018, 11:10 PM   #1
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default Any idea how to resize dockers through scripts?

You know those REAPER configurations that take one track in mixer, make it sidebar layout and resize it so it looks like inspector layout?



But lets say you use multiple themes, each with different layouts and you don't want to WALTER yourself out of this situation. Instead, you want to resize dockers with API so you can easily add more themes later.


I'll first attempt to solve this with python and pywin32 library for it, but maybe some of you already have some code snippets on what is the best way to accomplish this? Maybe update screensets file before loading the screenset? (but if memory serves me right, screensets file is read once and that's it...can't edit it while REAPER is running)
__________________
REAPER ReWorked: An elegant and self-sufficient all-around REAPER configuration
Other stuff

Last edited by Breeder; 09-03-2020 at 03:28 PM.
Breeder is offline   Reply With Quote
Old 01-02-2019, 05:56 AM   #2
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

With this code I can get the info of all docks - visible or hidden :
Code:
local hWnd_array = reaper.new_array({}, 100)
reaper.JS_Window_ArrayFind("REAPER_dock", true, hWnd_array)
dock = hWnd_array.table()
for i = 1, #dock do
  local hwnd = reaper.JS_Window_HandleFromAddress(dock[i])
  local _, left, top, right, bottom = reaper.JS_Window_GetClientRect( hwnd )
  dock[i] = {hwnd = hwnd, l = left, t = top, r = right, b = bottom, w = (right-left), h = (bottom-top)}
end

But when I try to resize using reaper.JS_Window_Resize, is seems to just move the contents of the dock without resizing. I am afraid that is all I can offer . Someone, more knowledgeable maybe can help?... ( I am interested in this too. Reaper Docks are a mystery to me)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 01-02-2019 at 06:01 AM.
amagalma is online now   Reply With Quote
Old 01-02-2019, 12:33 PM   #3
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

AFAIK, you can't.
Reaper.ini holds dock dimensions, but overwriting the values doesn't have any affect without restarting Reaper. I've tried to have real-time control over dock dimensions with no success.
ErBird is offline   Reply With Quote
Old 01-02-2019, 12:37 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by amagalma View Post

But when I try to resize using reaper.JS_Window_Resize, is seems to just move the contents of the dock without resizing.
Try, reaper.JS_Window_SetPosition , tried on bottom docker, it resizes but then the rest of reaper interface also needs a refresh so all the other stuff is resized also, Hmmmmm?

EDIT
OK, if I send a mouse click to the docker it acts as if I resized the docker with mouse, and REAPER interface is fixed!

Code:
function JS_LMouseDownUp(hWnd) 
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONDOWN", 0, 0, 0, 0)
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONUP", 0, 0, 0, 0)
end

local hWnd_array = reaper.new_array({}, 100)
reaper.JS_Window_ArrayFind("REAPER_dock", true, hWnd_array)
dock = hWnd_array.table()
for i = 1, #dock do
  local hwnd = reaper.JS_Window_HandleFromAddress(dock[i])
  local _, left, top, right, bottom = reaper.JS_Window_GetClientRect( hwnd )
  dock[i] = {hwnd = hwnd, l = left, t = top, r = right, b = bottom, w = (right-left), h = (bottom-top)}
end

-- dock[10] is my bottom docker, shrink height by 60 pixels.. 
reaper.JS_Window_SetPosition( dock[10].hwnd, dock[10].l, dock[10].t, dock[10].w, dock[10].h-60)
-- click it , workaround so REAPER resizes other objects!
JS_LMouseDownUp(dock[10].hwnd)

Last edited by Edgemeal; 01-02-2019 at 07:02 PM.
Edgemeal is offline   Reply With Quote
Old 01-02-2019, 12:54 PM   #5
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Nope! I tried it with my left docker


Code:
-- dock[4] is my left docker. Increase width by 100 pixels
reaper.JS_Window_SetPosition( dock[4].hwnd, dock[4].l, dock[4].t, dock[4].w+100, dock[4].h)

Didn't work. It just shifted the contents

Edit: Still does not work, even with the mouseclick. I am talking about the left docker which is next to the TCP trackview.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 01-02-2019 at 01:00 PM.
amagalma is online now   Reply With Quote
Old 01-02-2019, 01:35 PM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by amagalma View Post
Nope! I tried it with my left docker


Code:
-- dock[4] is my left docker. Increase width by 100 pixels
reaper.JS_Window_SetPosition( dock[4].hwnd, dock[4].l, dock[4].t, dock[4].w+100, dock[4].h)

Didn't work. It just shifted the contents

Edit: Still does not work, even with the mouseclick. I am talking about the left docker which is next to the TCP trackview.
Ya left is weird, I can resize width of right tho.
Edgemeal is offline   Reply With Quote
Old 01-02-2019, 11:52 PM   #7
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Hey guys - thanks for all the responses!

I remember from SWS that pretty much anything you want is possible using win32 - the trick is taking care of all the little corner cases and that needs testing and then some more testing

Edgemeal, I think you might just be unto something. The only trouble I see with mouse click simulations is presented in a question: "Will it work if something glitches or takes a bit too long to load". I guess that's the testing part

In any case - I believe that changing REAPER themes during production can offer significant creativity boost and this script could shave off the hours needed to REWALTER every theme you plan on using. I'll definetly check it out when I catch the time, thank you so, so much guys, you're golden! <3
Breeder is offline   Reply With Quote
Old 03-01-2019, 11:07 AM   #8
lunker
Human being with feelings
 
lunker's Avatar
 
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleå, Sweden)
Posts: 2,009
Default

Is there any update on this?

I am trying to use the code above to change the size of my floating FX docker.

It moves the contents of the FX window inside the docker to a new position, but I want to move the position of the entire docker (which is floating).

Am I missing something? Or is the API not quite capable of this yet?
__________________
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700
lunker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.