|
|
|
06-17-2020, 05:36 AM
|
#1
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Script for screen-centering an opened FX Chain Window ?
Dear Scripters,
I have seen some scripts in the past regarding screen-centering an opened FX Window.
But these scripts don't seem to work regarding an opened FX Chain Window.
Is it possible to make a Script that centers an opened a FX Chain Window ?
BTW: I use only 1 monitor.
TIA !
|
|
|
06-19-2020, 12:26 PM
|
#2
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
+1 multiple screen user here
|
|
|
06-19-2020, 03:28 PM
|
#3
|
Human being with feelings
Join Date: Jan 2019
Location: Toronto, Canada
Posts: 533
|
+1 - would be very handy!!
|
|
|
06-20-2020, 08:18 AM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Lua script (requires JS_ReascriptAPI):
Code:
local number, list = reaper.JS_Window_ListFind("FX: ", false)
if number > 0 then
for address in list:gmatch("[^,]+") do
local FX_win = reaper.JS_Window_HandleFromAddress(address)
local title = reaper.JS_Window_GetTitle(FX_win)
if title:match("FX: Track ") or title:match("FX: Master Track") or title:match("FX: Item ") then
local _, left, top, right, bottom = reaper.JS_Window_GetRect(FX_win)
local pos_x, pos_y, screen_w, screen_h = reaper.my_getViewport(0, 0, 0, 0, left, top, right, bottom, true)
local width = right - left
local height = math.abs(bottom - top)
left = math.floor((screen_w+pos_x)/2 - width/2)
top = math.floor((screen_h+pos_y)/2 - height/2)
reaper.JS_Window_SetPosition( FX_win, left, top, width, height )
end
end
end
reaper.defer(function() end)
Edit: Updated code to work with multiple monitors (it will center the FX chain in the monitor that the Chain is currently)
Last edited by amagalma; 06-20-2020 at 10:30 AM.
|
|
|
06-20-2020, 08:59 AM
|
#5
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by amagalma
Lua script (requires JS_ReascriptAPI):
Code:
local number, list = reaper.JS_Window_ListFind("FX: ", false)
if number > 0 then
local _, _, screen_w, screen_h = reaper.my_getViewport(0,0,0,0,0,0,0,0, true )
for address in list:gmatch("[^,]+") do
local FX_win = reaper.JS_Window_HandleFromAddress(address)
local title = reaper.JS_Window_GetTitle(FX_win)
if title:match("FX: Track ") or title:match("FX: Master Track") or title:match("FX: Item ") then
local _, left, top, right, bottom = reaper.JS_Window_GetRect(FX_win)
local width = right - left
local height = math.abs(bottom - top)
left = math.floor(screen_w/2 - width/2)
top = math.floor(screen_h/2 - height/2)
reaper.JS_Window_SetPosition( FX_win, left, top, width, height )
end
end
end
reaper.defer(function() end)
|
thx amagalma ! u made my day
it seems not wrking on OSX T_T
perhaps i didnt use it correctly ?
|
|
|
06-20-2020, 10:14 AM
|
#6
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
I've just checked it on VMware macOS Catalina and it works here...
Do you have an open floating FX Chain?
Edit: Updated code to work with multiple monitors (it will center the FX chain in the monitor that the Chain is currently)
Last edited by amagalma; 06-20-2020 at 10:30 AM.
|
|
|
06-20-2020, 09:54 PM
|
#7
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by amagalma
I've just checked it on VMware macOS Catalina and it works here...
Do you have an open floating FX Chain?
Edit: Updated code to work with multiple monitors (it will center the FX chain in the monitor that the Chain is currently)
|
Sry I wasn't pay attention to "FXChain"... I test it with regular fx window that's why it didn't wrk (my bad)
After testing it with fxChain wrks like a charm now
btw is it possible to make it wrk on regular fx window as well ?
|
|
|
06-20-2020, 10:35 PM
|
#8
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
This is tricky... If there are lots of floating FX, which one? Should it be the focused one?
And if there is an fx_chain and a floating FX, which of the two?
Last edited by amagalma; 06-20-2020 at 10:44 PM.
|
|
|
06-20-2020, 11:39 PM
|
#9
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
I think this should do it:
Code:
-- Requires JS_ReaScriptAPI
local exists, tracknumber, itemnumber, fxnumber = reaper.GetFocusedFX()
local FX_win
if exists > 0 then
local track = reaper.CSurf_TrackFromID( tracknumber, false )
if exists == 1 then
FX_win = reaper.TrackFX_GetFloatingWindow( track, fxnumber )
else
local item = reaper.GetTrackMediaItem( track, itemnumber )
local take = reaper.GetMediaItemTake(item, fxnumber >> 16)
FX_win = reaper.TakeFX_GetFloatingWindow( take, fxnumber )
end
end
if not FX_win then
-- Try again
local number, list = reaper.JS_Window_ListFind("FX: ", false)
if number > 0 then
for address in list:gmatch("[^,]+") do
local hwnd = reaper.JS_Window_HandleFromAddress(address)
local title = reaper.JS_Window_GetTitle(hwnd)
if (tracknumber > 0 and (title:match("FX: Track " .. tracknumber) or title:match("FX: Item ") ) ) or
title:match("FX: Master Track") then
FX_win = hwnd
break
end
end
end
end
if FX_win then
local _, left, top, right, bottom = reaper.JS_Window_GetRect(FX_win)
local pos_x, pos_y, screen_w, screen_h = reaper.my_getViewport(0, 0, 0, 0, left, top, right, bottom, true)
local width = right - left
local height = math.abs(bottom - top)
left = math.floor((screen_w+pos_x)/2 - width/2)
top = math.floor((screen_h+pos_y)/2 - height/2)
reaper.JS_Window_SetPosition( FX_win, left, top, width, height )
end
reaper.defer(function() end)
Works for floating fx and fx chains too.
Last edited by amagalma; 06-21-2020 at 02:49 AM.
|
|
|
06-21-2020, 02:57 AM
|
#10
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Uploaded it to ReaPack
|
|
|
06-21-2020, 03:29 AM
|
#11
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by amagalma
Uploaded it to ReaPack
|
it wrksssss
|
|
|
06-21-2020, 03:44 AM
|
#12
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by amagalma
This is tricky... If there are lots of floating FX, which one? Should it be the focused one?
|
yeah, bring the focused one to center might be the best.
Quote:
Originally Posted by amagalma
And if there is an fx_chain and a floating FX, which of the two?
|
ur right..sometimes thrr would be many floating FX or FXChain, in my case
they float on the other screen for me to inspect them easier.
so usually I leave them thrr always.
most of my floating window on the 2nd monitor were came from monitoringFX.
so I was thinking , perhaps we could make a flexible filter with a simple user config area for ppl to leave all the FX windows and FXChain on specific track or MonitoringFX untouched ?
|
|
|
06-23-2020, 08:51 PM
|
#13
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Hi amagalma,
Many thanks for making this Script !
But it doesn't work for me:
- I use 1 monitor.
- OSX 10.15.5
- Using the script version that comes in ReaPack.
- I open 1 FX Chain Window, belonging to a selected Track.
This FX Chain Window is placed somewhat top left of my monitor screen.
- I fire your Script : nothing happens: The FX Chain Window isn't centered on screen.
Any clue maybe ?
|
|
|
06-24-2020, 11:51 AM
|
#14
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by vanhaze
Hi amagalma,
Many thanks for making this Script !
But it doesn't work for me:
- I use 1 monitor.
- OSX 10.15.5
- Using the script version that comes in ReaPack.
- I open 1 FX Chain Window, belonging to a selected Track.
This FX Chain Window is placed somewhat top left of my monitor screen.
- I fire your Script : nothing happens: The FX Chain Window isn't centered on screen.
Any clue maybe ?
|
Just checked in my VMWare Catalina and it works here.. Could you make a licecap?
|
|
|
06-24-2020, 07:10 PM
|
#15
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by amagalma
Just checked in my VMWare Catalina and it works here.. Could you make a licecap?
|
tested here in OSX , all good.
thx for this handy feature, donated.
thank u amagalma
|
|
|
06-25-2020, 02:28 AM
|
#16
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by todoublez
tested here in OSX , all good.
thx for this handy feature, donated.
thank u amagalma
|
Thank you todoublez
|
|
|
08-11-2020, 06:24 PM
|
#17
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Hi amagalma,
Is there a way this script could be modified to skip 'offline' FX?
I use Reaper for mastering and I will generally load an FX chain with my most commonly used tools and bring them online if/when needed depending on the mix. I would love to be able to use your script but it currently doesn't play nicely when only a few FX are online in a chain.
|
|
|
08-12-2020, 08:22 AM
|
#18
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by pond
Hi amagalma,
Is there a way this script could be modified to skip 'offline' FX?
I use Reaper for mastering and I will generally load an FX chain with my most commonly used tools and bring them online if/when needed depending on the mix. I would love to be able to use your script but it currently doesn't play nicely when only a few FX are online in a chain.
|
Could you make a licecap because I didn't understand what is the issue? Here, the script centers an FX chain with all FX being offline..
|
|
|
08-13-2020, 01:34 AM
|
#19
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Ahh apologies... I have posted in the wrong thread. I actually meant your other script -- "Script: amagalma_Float centered exclusively the next FX for the current track.lua"
|
|
|
08-13-2020, 02:24 AM
|
#20
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Oh, I see.. I'll look into this
|
|
|
08-13-2020, 03:53 AM
|
#21
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by pond
Ahh apologies... I have posted in the wrong thread. I actually meant your other script -- "Script: amagalma_Float centered exclusively the next FX for the current track.lua"
|
Fixed!
v1.1 should work fine
|
|
|
08-13-2020, 05:15 PM
|
#22
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Whoah! So fast!
Just tested it now and it is working perfectly. This is such a huge workflow improvement (I'm a keyboard before mouse person). Great work, thanks heaps amagalma!! 👍
If I can ask one more question, are you aware of any action that could make the selected FX (in the FX chain) mirror the one that is currently floated using your script?
I would love to be able to reopen the most recently floating FX (after having closed it) with a keyboard shortcut, but "SWS/S&M: Float selected FX for selected tracks" doesn't achieve this since it follows the currently selected FX in the chain...
|
|
|
08-14-2020, 12:03 AM
|
#23
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by pond
I would love to be able to reopen the most recently floating FX (after having closed it)
|
Try " amagalma_Re-open and float the last touched and closed FX" in ReaPack, just uploaded it.
Note: it re-opens the last touched FX, not the last focused, as there is no API for this.
|
|
|
08-14-2020, 12:46 AM
|
#24
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
You legend! Just downloaded and tested, it will definitely do the trick. Thanks so much
|
|
|
08-17-2020, 11:43 AM
|
#25
|
Human being with feelings
Join Date: Aug 2011
Posts: 1,272
|
Wow this script is awesome. Is there a way to make it fire automatically when an FX window is opened?
|
|
|
11-04-2020, 08:35 PM
|
#26
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Hey again amagalma!
I've been using your scripts everyday:
1) "amagalma_Float centered exclusively the next FX for the current track.lua"
2) "amagalma_Re-open and float the last touched and closed FX"
They are fantastic and thanks again for making the tweaks that I requested previously. I have another question/request...would it be possible to have versions of these two scripts that are limited in scope to the selected track?
ie. modified so that:
script#1 does not close any floated fx windows from other tracks (the master track in my case)
and script#2 opens the last touched and closed FX from the selected track only, rather than any track in the project
I'm not sure if these requests are even possible, but I will happily donate again if they are.
Cheers
|
|
|
11-05-2020, 12:04 PM
|
#27
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
#1 is very easy.. Edit the script and go to line 104:
change it to:
#2 is tricky.. Reaper does not store such info.. so it would require a script running in the background all the time and saving this, so that the other script could access that information.. Could be done.. But it is not a modification of that script but rather two completely new scripts..
|
|
|
11-06-2020, 02:29 PM
|
#28
|
Human being with feelings
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
|
Hi! Why it's not working in this action?
It adds fx window top left corner, only when I trigger it second time it brings next instance of Pro-Q to the center.
|
|
|
11-07-2020, 01:05 AM
|
#29
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Skorobagatko
Hi! Why it's not working in this action?
It adds fx window top left corner, only when I trigger it second time it brings next instance of Pro-Q to the center.
|
Because the actions in the custom action are run immediately one after the other, while the computer needs a few moments to load the FX. So when the Center_in_screen action is run the FX has not finished loading yet, so its window is not existent. Try to insert one of the Wait actions (for example: "Wait 0.1 seconds before next action") after inserting the FX and before trying to center it.
|
|
|
11-07-2020, 04:06 AM
|
#30
|
Human being with feelings
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
|
Quote:
Originally Posted by amagalma
Because the actions in the custom action are run immediately one after the other, while the computer needs a few moments to load the FX. So when the Center_in_screen action is run the FX has not finished loading yet, so its window is not existent. Try to insert one of the Wait actions (for example: "Wait 0.1 seconds before next action") after inserting the FX and before trying to center it.
|
Nope, even 2 seconds of wait actions donig nothing here. Any ideas how to achieve a result with this? Maybe it'd be possible with cycle action?
|
|
|
11-07-2020, 10:15 AM
|
#31
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Does the Pro Q window show or not?
|
|
|
11-07-2020, 11:17 AM
|
#32
|
Human being with feelings
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
|
Quote:
Originally Posted by amagalma
Does the Pro Q window show or not?
|
Yes, it appears at top left corner. Don't understand why exactly there.
|
|
|
11-08-2020, 12:48 AM
|
#33
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Try different combinations of these settings and see what happens:
|
|
|
11-08-2020, 07:10 PM
|
#34
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Thanks for replying!
Quote:
Originally Posted by amagalma
#1 is very easy.. Edit the script and go to line 104:
change it to:
|
Perfect!
Quote:
Originally Posted by amagalma
#2 is tricky.. Reaper does not store such info.. so it would require a script running in the background all the time and saving this, so that the other script could access that information.. Could be done.. But it is not a modification of that script but rather two completely new scripts..
|
Ahh I see. That's okay, I don't think it is worth all that trouble.
Would the API allow for your "float and center next fx" script to also select that effect? In that way I could simply use the "SWS float selected fx for selected tracks" action
|
|
|
11-09-2020, 12:48 AM
|
#35
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by pond
...
2) "amagalma_Re-open and float the last touched and closed FX"
...
and script#2 opens the last touched and closed FX from the selected track only, rather than any track in the project
|
Quote:
Would the API allow for your "float and center next fx" script to also select that effect? In that way I could simply use the "SWS float selected fx for selected tracks" action
|
It doesn't work this way. Select a track which has FX loaded but none is visible and run my script. It opens FX1. Run again the script. It shows FX2, run again and it shows FX3. Now close the FX window and run again the script. It shows FX1, not FX4.
As I said, Reaper doesn't store which FX was last visible for each track. It only stores which was the last *touched* FX in the project (note: touched does not equal visible). In order Reaper remembers which track was last visible for each track, a script that stores this information must be made. There is no other way.
Last edited by amagalma; 11-09-2020 at 12:54 AM.
|
|
|
11-09-2020, 03:39 AM
|
#36
|
Human being with feelings
Join Date: Nov 2018
Posts: 10
|
Ok I think I understand now, thanks for explaining and sorry that you had to repeat yourself a bit there.
I'm still really happy with the way these scripts are working, btw. Not to mention a whole bunch of others that you've written. Thanks so much for all the contributions you've made!
|
|
|
03-22-2021, 04:38 PM
|
#37
|
Human being with feelings
Join Date: Sep 2016
Posts: 513
|
Hello its very slow reactivity can change that please ?
|
|
|
10-14-2021, 12:37 PM
|
#38
|
Human being with feelings
Join Date: Aug 2012
Location: Around Montréal
Posts: 1,117
|
Quote:
Originally Posted by Skorobagatko
Hi! Why it's not working in this action?
It adds fx window top left corner, only when I trigger it second time it brings next instance of Pro-Q to the center.
|
Quote:
Originally Posted by Skorobagatko
Nope, even 2 seconds of wait actions donig nothing here. Any ideas how to achieve a result with this? Maybe it'd be possible with cycle action?
|
Did somebody found a solution to make this work ?
|
|
|
07-18-2022, 09:01 PM
|
#39
|
Human being with feelings
Join Date: Feb 2020
Posts: 112
|
Quote:
Originally Posted by Pinknoise
Did somebody found a solution to make this work ?
|
Bump for this inquiry - same problem here, have to use action twice to get proper centering.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:37 AM.
|