Old 06-12-2020, 11:10 PM   #1
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default Anybody know of a script to set TCP widths ?

As the title says, looking for a script to change the width of the TCP, to a bunch of specific sizes that i can assign to a toolbar.



Anybody got any ideas ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-13-2020, 08:06 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

I have an idea and maybe it works.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-13-2020, 11:23 AM   #3
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,512
Default

I don't think that's possible with scripts, though I could be wrong. The panel state is stored in screenset window sets though, so you could set up your screensets and load those with toolbar buttons.

edit: it's a bit clunky though, a script would be better.

Last edited by IXix; 06-13-2020 at 12:02 PM.
IXix is offline   Reply With Quote
Old 06-13-2020, 12:07 PM   #4
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,512
Default

It's in REAPER.ini as "leftpanewid" but I don't know if you can access it via scripting.


(Goes off to look at API docs...)

(Comes back, defeated)

No, sorry, I'm not powerful enough.

Last edited by IXix; 06-13-2020 at 12:32 PM. Reason: lack of power
IXix is offline   Reply With Quote
Old 06-13-2020, 01:43 PM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

You can't set it in the reaper.ini, only read from it. It's always updated, when someone drags the size of the TCP, so you always have the most recent width in this entry.
But setting it doesn't have an effect, as Reaper doesn't read it from the reaper.ini while running, only when starting.

As I said, I'm on it and I hope, I can come up with a function for my Ultraschall-API.

I already managed to change the TCP-width, but I had graphics-issues in the main-toolbar and arrange-view because of that. So I need to spend more time on that.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-13-2020, 01:56 PM   #6
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,512
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I already managed to change the TCP-width, but I had graphics-issues in the main-toolbar and arrange-view because of that. So I need to spend more time on that.
You are powerful.
IXix is offline   Reply With Quote
Old 06-13-2020, 02:04 PM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

Quote:
Originally Posted by IXix View Post
You are powerful.
Repeat this, when I actually managed to do it properly, please
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-13-2020, 03:32 PM   #8
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

It doesnt work in screensets, maybe its buggy, but it seemingly changed to random sizes on each screenset i saved.
Thats why i Thought script may be the only way, not that i would actually know.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-13-2020, 07:42 PM   #9
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Without Justin giving us access to that I think we have to hack it.
Quick test works for me on Win10, example reduce TCP width by 100 pixels...

Requires, js_ReaScriptAPI extension.
Edit clean it up a little,
Code:
function Main()
  local main = reaper.GetMainHwnd()
  local arrange = reaper.JS_Window_FindChildByID(main, 0x3E8)
  local _,x,y = reaper.JS_Window_GetRect(arrange) 
  x=x-5 -- splitter area ~10 pixels wide.
  x,y = reaper.JS_Window_ScreenToClient(main, x, y)
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONDOWN", 1, 0, x, y) -- mouse down message at splitter location
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONUP", 0, 0, x-100, y) -- move left 100 pixels, mouse up message
end

Last edited by Edgemeal; 06-13-2020 at 08:11 PM.
Edgemeal is offline   Reply With Quote
Old 06-14-2020, 03:13 AM   #10
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,512
Default

Quote:
Originally Posted by Edgemeal View Post
Without Justin giving us access to that I think we have to hack it.
Ha! Sneaky!
IXix is offline   Reply With Quote
Old 06-14-2020, 07:54 AM   #11
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by IXix View Post
Ha! Sneaky!
That wasn't my intention , theres already a few FRs asking to resize dockers, which I'm guessing this code could also do (didn't try) once you figure out where the splitter is on the screen, etc... I'd try it but its another beautiful summer day, gotta go hit the bike trails.
Edgemeal is offline   Reply With Quote
Old 06-14-2020, 08:10 AM   #12
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Quote:
Originally Posted by Edgemeal View Post
Without Justin giving us access to that I think we have to hack it.
Quick test works for me on Win10, example reduce TCP width by 100 pixels...

Requires, js_ReaScriptAPI extension.
Edit clean it up a little,
Code:
function Main()
  local main = reaper.GetMainHwnd()
  local arrange = reaper.JS_Window_FindChildByID(main, 0x3E8)
  local _,x,y = reaper.JS_Window_GetRect(arrange) 
  x=x-5 -- splitter area ~10 pixels wide.
  x,y = reaper.JS_Window_ScreenToClient(main, x, y)
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONDOWN", 1, 0, x, y) -- mouse down message at splitter location
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONUP", 0, 0, x-100, y) -- move left 100 pixels, mouse up message
end
That is a mouse movement clone sort of thing, right ? (Sorry at work at the moment)
That wont really work in this context, because it isnt a specific size being set but actually adjust size from current, so you couldnt just set specific sizes per toolbar.
Cool as **** hack/idea though, well impressive.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-14-2020, 08:17 AM   #13
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

Have you tried and it didn't work? What happened when you tried to use it as toolbar action?
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-14-2020, 08:35 AM   #14
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,192
Default

Quote:
Originally Posted by Edgemeal View Post
Without Justin giving us access to that I think we have to hack it.
Quick test works for me on Win10, example reduce TCP width by 100 pixels...

Requires, js_ReaScriptAPI extension.
Edit clean it up a little,
Code:
function Main()
  local main = reaper.GetMainHwnd()
  local arrange = reaper.JS_Window_FindChildByID(main, 0x3E8)
  local _,x,y = reaper.JS_Window_GetRect(arrange) 
  x=x-5 -- splitter area ~10 pixels wide.
  x,y = reaper.JS_Window_ScreenToClient(main, x, y)
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONDOWN", 1, 0, x, y) -- mouse down message at splitter location
  reaper.JS_WindowMessage_Send(main, "WM_LBUTTONUP", 0, 0, x-100, y) -- move left 100 pixels, mouse up message
end
Impressive hack as always! Well done sir!

Quote:
Originally Posted by gpunk_w View Post
That is a mouse movement clone sort of thing, right ? (Sorry at work at the moment)
That wont really work in this context, because it isnt a specific size being set but actually adjust size from current, so you couldnt just set specific sizes per toolbar.
Cool as **** hack/idea though, well impressive.
Just replace x-100 with any number you like and it will set a specific size. Eg:
Code:
reaper.JS_WindowMessage_Send(main, "WM_LBUTTONUP", 0, 0, 500, y)
amagalma is online now   Reply With Quote
Old 06-14-2020, 11:32 AM   #15
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

But it just moves the divider x number of pixels, so say i am on the large size and i press the small size tool button, it shrinks it to that size, but if i want medium size, it would need to know what size i am at, because if im on large and shrink to medium, it will be a different number of pixels and opposite direction to get to medium from small.
So the script has to be exact widths.

Edit
Hadnt read amalgama reply lol, will try as soon as i get home, cheers.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-14-2020, 01:33 PM   #16
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by gpunk_w View Post
That is a mouse movement clone sort of thing, right ?
Script basically sends REAPER the same messages it gets when you use the mouse to change the TCP width, so it should work the same.

Quote:
Originally Posted by gpunk_w View Post
Hadnt read amalgama reply lol, will try as soon as i get home, cheers.
Sorry if it was confusing, Hope it works/helps.
Edgemeal is offline   Reply With Quote
Old 06-14-2020, 10:31 PM   #17
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Yeah unfortunately I am not clever enough to get it to work, I copied your text into a file and called it tcp_width.lua and put the jsreascriptapi.dll in the user plugins folder, but it obviously needs more than that because it does nothing.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-14-2020, 10:35 PM   #18
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Tried it as .eel too and it just throws an error.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:16 AM   #19
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Any hints on this ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:16 AM   #20
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by gpunk_w View Post
Yeah unfortunately I am not clever enough to get it to work, I copied your text into a file and called it tcp_width.lua and put the jsreascriptapi.dll in the user plugins folder, but it obviously needs more than that because it does nothing.
Are you on MAC?, I only have Windows.
Edgemeal is offline   Reply With Quote
Old 06-15-2020, 06:18 AM   #21
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

No, I was trying on Win 10.
Is there anything I have to add to that text when i save it as a script ?
Do I save it as .lua or .eel ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:19 AM   #22
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Which version should i install of reascriptapi ?
I used the one from 25 days ago (Latest) off the github.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:29 AM   #23
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by gpunk_w View Post
Which version should i install of reascriptapi ?
I used the one from 25 days ago (Latest) off the github.
It shouldn't matter as long as it is somewhat recent. I'm still using v1.002, and just updated to REAPER v6.12/x64. The script is Lua script.
Edgemeal is offline   Reply With Quote
Old 06-15-2020, 06:30 AM   #24
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

ok ill try the same v number
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:34 AM   #25
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Nah, no difference.
Anyway i can test if Reascriptapi js extension is working ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 06:43 AM   #26
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by gpunk_w View Post
Nah, no difference.
Anyway i can test if Reascriptapi js extension is working ?
Maybe try simple version check,
Code:
if reaper.APIExists('JS_ReaScriptAPI_Version') then
  ver = 'JS v' .. reaper.JS_ReaScriptAPI_Version()
else
  ver = "JS API not installed"  
end
reaper.ShowConsoleMsg(ver .. '\n')


Here is the script, where you can change the number in script name to set aprox width,
Example, to set TCP width aprox 448 pixels, copy and rename the script, "Set TCP width 448.lua".

Last edited by Edgemeal; 06-15-2020 at 09:37 AM.
Edgemeal is offline   Reply With Quote
Old 06-15-2020, 06:51 AM   #27
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Yeah that script worked first time, no idea why the other doesnt ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 07:10 AM   #28
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Slick
This is absolutely perfect, cheers for that, will try it on Mac in a few days and let you know what happens.


__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 07:32 AM   #29
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Just an FYI, It does have a strange side effect, it is always working out the width based on the left hand edge of the screen, as you can see when I have my media browser open, just means you cant change the width while the browser is open.

__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 08:18 AM   #30
DanSwizer
Human being with feelings
 
DanSwizer's Avatar
 
Join Date: Sep 2019
Posts: 27
Default

Quote:
Originally Posted by gpunk_w View Post
Just an FYI, It does have a strange side effect, it is always working out the width based on the left hand edge of the screen, as you can see when I have my media browser open, just means you cant change the width while the browser is open.
Hey man sorry for off-top.What coolest theme on the picture?
DanSwizer is offline   Reply With Quote
Old 06-15-2020, 08:47 AM   #31
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

My own theme.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 09:18 AM   #32
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Quote:
Originally Posted by Edgemeal View Post
Try this one...
Just running out to work, but tested it quickly and looks like it works
Will send you a drink when I get home, cheers mate.
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   Reply With Quote
Old 06-15-2020, 10:07 AM   #33
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

@Edgemeal

I would like to add your SetTCPWidth-function to Ultraschall-API, if you don't mind...
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-15-2020, 10:56 AM   #34
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
@Edgemeal

I would like to add your SetTCPWidth-function to Ultraschall-API, if you don't mind...
Can you try this slightly tweaked version, and on MAC also?

Note: The width setting when OS scaling is 100% will not be the same when set to higher scaling modes like 125%, not sure if thats possible to fix or not with API we have.

EDIT I have a feeling it wont work on MAC since its using JS_Window_FindEx to find the TCP by its classname of "REAPERTCPDisplay".
See post #46 for script

Last edited by Edgemeal; 06-23-2020 at 01:09 PM. Reason: Update script: Check if tcp_hwnd is valid
Edgemeal is offline   Reply With Quote
Old 06-15-2020, 11:14 AM   #35
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

Quote:
Originally Posted by Edgemeal View Post
Can you try this slightly tweaked version, and on MAC also?

Note: The width setting when OS scaling is 100% will not be the same when set to higher scaling modes like 125%, not sure if thats possible to fix or not with API we have.

EDIT I have a feeling it wont work on MAC since its using JS_Window_FindEx to find the TCP by its classname of "REAPERTCPDisplay".
I have means in my Ultraschall-API to get the TCP. It checks for arrange and ruler, who have hwnd-ids(who are available on Mac as well) and tries to find a hwnd, whose

right side=left side of arrange and ruler and
top=bottom of ruler, top of arrange

if I remember correctly.

As classes don't work on Mac(maybe Linux as well?), it was my workaround.

You can check the GetHWND_ArrangeViewAndTimeLine-function in my API to see, how I did it in detail.
This works without a problem on Mac and Windows.

I just hope, Walter doesn't allow moving ruler and arrange-view hwnds away from the way they are aligned with TCP in Reaper's default view...

Edit: I should have proofread the post before. Corrected some of the information I wrote
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish

Last edited by Meo-Ada Mespotine; 06-15-2020 at 11:18 AM. Reason: finetuning
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-15-2020, 11:34 AM   #36
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,867
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
As classes don't work on Mac(maybe Linux as well?), it was my workaround.
Ya thats what I thought, I don't do Apple, don't care to go down that path either. If you can get it to work on MAC have at it.
Edgemeal is offline   Reply With Quote
Old 06-15-2020, 11:56 AM   #37
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

Will do

Thanks
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-15-2020, 12:57 PM   #38
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,192
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
right side=left side of arrange and ruler and
top=bottom of ruler, top of arrange
Do not forget that TCP can be shown at the right side too

Code:
Show TCP on right side of arrange [action 42373]

Last edited by amagalma; 06-15-2020 at 02:10 PM.
amagalma is online now   Reply With Quote
Old 06-15-2020, 03:53 PM   #39
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 686
Default

Holy shit, you're right! Ok, I need to alter my code for that.
This can become difficult... 😭
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-15-2020, 11:11 PM   #40
gpunk_w
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,365
Default

Quote:
Originally Posted by Edgemeal View Post
Can you try this slightly tweaked version, and on MAC also?

Note: The width setting when OS scaling is 100% will not be the same when set to higher scaling modes like 125%, not sure if thats possible to fix or not with API we have.

EDIT I have a feeling it wont work on MAC since its using JS_Window_FindEx to find the TCP by its classname of "REAPERTCPDisplay".
Is this an extra new tweak since the last one i tried (300)

Also I can't find a donation link to send you a drink ?
__________________
Reaper scripters, that is all !!!!!!!!!!!!!!!!
gpunk_w is online now   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 12:02 PM.


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