Old 08-07-2018, 11:42 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default Move Mixer out of the way: example of Win32/SWELL in ReaScript

Some users have noted that the Mixer gets in the way of FX and other windows:

Quote:
Originally Posted by D Rocks View Post
... For now I only noticed the Mixer Window getting in front of floating FX that I dont automatically think of putting "always on top". I could develop the habit to click always on top each time a new FX window is openned but I'll find a solution that does it automatically somehow until it becomes built-in.

What do you think could be done with the script you mentionned? It would be Lua?
This problem can serve as an example of using Win32/SWELL functions in ReaScripts. Here are two alternatives:
* A script that moves the mixer to the back when you press a shortcut.
* A script that runs in the background a automatically moves the mixer to the back when you click on another window.

(A test build of SWS for Windows x64 is required.)

Code:
-- Move Mixer window (docker or undocked) to the back when shortcut is pressed
m = reaper.Window_Find("Mixer (docked)", true)
if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
m = reaper.Window_Find("Mixer", true)
if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
reaper.defer(function() end)
Code:
-- This script runs the background, automatically moving Mixer window to the back when it loses focus.
function loop()
    w = reaper.Window_GetForeground()
    if w and w ~= prevW then -- Has foreground window been changed?
        prevW = w
        -- Check if new foreground window is Mixer. If not, try to find Mixer and and if it exists, move it back
        t = reaper.Window_GetTitle(w, "") 
        if not t:match("Mixer") then
            m = reaper.Window_Find("Mixer (docked)", true)
            if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
            m = reaper.Window_Find("Mixer", true)
            if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
    end end
    reaper.defer(loop)
end

reaper.atexit()

loop()

Last edited by juliansader; 10-13-2018 at 01:45 PM.
juliansader is offline   Reply With Quote
Old 08-07-2018, 12:28 PM   #2
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,496
Default

Just installed the test build...there's very interesting and long-awaited stuff incoming, thanks!
When is the official release?
spk77 is offline   Reply With Quote
Old 08-07-2018, 07:56 PM   #3
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,396
Default

Your new functions are real cool stuff, I've toyed around with them the last few days

I wrote a comment on GitHub for your PR on some issues. Maybe this could make the stuff even better.

Thanks for your hard work
mespotine is offline   Reply With Quote
Old 08-08-2018, 08:41 AM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,255
Default

Even if Mixer is pinned the scripts still work! Nice job!

Running the automatic script...
When opening a routing window from Mixer open fx windows can cover the routing window if in same location, not sure that can be avoided or not?

When switching from REAPER to say NotePad the script throws an error...

...\Scripts\Automatically move Mixer window to the back.lua:7: 'reaper.Window_GetTitle' argument 1: expected void*

Win7 / REAPER 5.95_pre3 (portable) / x64
Edgemeal is offline   Reply With Quote
Old 08-08-2018, 10:11 AM   #5
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

Wow Im not home for a while but Ill try to test somehow soon. Thanks alot man this seems to be a excellent workaround with the background script option.

Thanks for taking time to help solve this.

EDIT: where do you move the reaper_sws64.dll for test build?

EDIT2: found it by reinstalling sws and looking at the path thanks. (Reaper main folder/plugin)

EDIT3: I was able to test. First step was installing the SWS test build. Then I added a new script which is saved in .Lua I then openned the mixer fullscreen/maximized and opened 3 FX windows. As soon as I click on the mixer window, the FX windows that were visible still get hidden permanently behind Mixer until I reopen them or close the mixer window.

My suggestions are:
Trying to create layers of priority to FX windows versus the Mixer (undocked). Or inversly, to make the Mixer have less priority over openned FX windows.

In this scenario, the importance of windows would look like:

- The bottom layer: the Arrange view/main window should be last priority so that every openned window hide it.
- The middle layer: would be the mixer which never get hidden by the arrange view but also always behind the opened FX windows.
- The top layer: The FX windows would be the top and greater priority layer so that they always mask windows under them until closed.

If this is possible with the current window classes it would be the best. Don't know how to get there but my clue is that Reaper Windows need an identifier that is related to layers of importance and visibility. With this we also wouldnt need the PIN for always on top I think.

EDIT4: What if the script would automatically make newly openned FX windows always on top?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-08-2018 at 12:43 PM.
D Rocks is offline   Reply With Quote
Old 08-08-2018, 10:48 AM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by Edgemeal View Post
When switching from REAPER to say NotePad the script throws an error...
Curious... It seems as if there may be short moments in which Windows has no foreground window.

I added a short "if w and" in the code above, to check for non-existent foreground windows.
juliansader is offline   Reply With Quote
Old 08-08-2018, 11:05 AM   #7
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,255
Default

Quote:
Originally Posted by juliansader View Post
Curious... It seems as if there may be short moments in which Windows has no foreground window.

I added a short "if w and" in the code above, to check for non-existent foreground windows.
That seems to have done the trick, No more error!
Edgemeal is offline   Reply With Quote
Old 08-08-2018, 12:36 PM   #8
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

Quote:
Originally Posted by Edgemeal View Post
That seems to have done the trick, No more error!
yes for me too same thing was fixed with modification
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 08-08-2018, 12:39 PM   #9
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by D Rocks View Post
EDIT4: at the simplest, I think that having a condition to move the mixer back when you click on the mixer window while FX windows are already opened would work
Do you want the mixer behind the FX windows, even *while* you are working in the mixer?
juliansader is offline   Reply With Quote
Old 08-08-2018, 01:04 PM   #10
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

I'm sorry about this confusion I removed the edit before I see your reply.

I am currently thinking of another solution to explain better and will post soon as a new FR thread for Justin and Schwa to see also. I'll link here

EDIT for new FR thread: https://forum.cockos.com/showthread....68#post2020668
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-09-2018 at 12:53 AM.
D Rocks is offline   Reply With Quote
Old 08-08-2018, 02:13 PM   #11
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,171
Default

Quote:
Originally Posted by juliansader View Post
Curious... It seems as if there may be short moments in which Windows has no foreground window.
I noticed something like that when using WindowGetForegound on fx window. It would change fast in the plugin area of the window but can have quite a delay changing to the fx window when pushing mouse button on title bar part.

(Made a rudimentary form of script that refocuses previous window on mouse button release. Some complications due to lack of understanding the hierarchies, especially when attached docker is involved. )
FnA is offline   Reply With Quote
Old 08-08-2018, 02:38 PM   #12
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

Hey guys,

I've finally suceeded with an AutoHotkey Script:


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, Force ;Won't allow running a useless duplicate of this script
ListLines, Off
#Persistent

SetTitleMatchMode, 2

; FX Window names to add to the group
GroupAdd, FX_Windows, FX: ahk_exe reaper.exe
GroupAdd, FX_Windows, DX: ahk_exe reaper.exe
GroupAdd, FX_Windows, DXi: ahk_exe reaper.exe
GroupAdd, FX_Windows, JS: ahk_exe reaper.exe
GroupAdd, FX_Windows, VST: ahk_exe reaper.exe
GroupAdd, FX_Windows, VST3: ahk_exe reaper.exe
GroupAdd, FX_Windows, VSTi: ahk_exe reaper.exe
GroupAdd, FX_Windows, VST3i: ahk_exe reaper.exe
; Other Windows to be AlwaysOnTop
GroupAdd, FX_Windows, Parameter Modulation/Link ahk_exe reaper.exe
GroupAdd, FX_Windows, Actions ahk_exe reaper.exe
GroupAdd, FX_Windows, REAPER Query ahk_exe reaper.exe


#if WinExist("Mixer ahk_exe reaper.exe")
;~LButton::
SetTimer, AlwaysOnTop, 10
AlwaysOnTop:
if WinActive("ahk_group FX_Windows")
{
WinGet, currentWindow, ID, A
WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
return
else
{
WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
SetTimer, AlwaysOnTop, 200
return
}
}
return


#if WinActive("ahk_exe reaper.exe")
;^LButton::
;F3::
Tab::
Send ^!+#x ; keycommand for "Toggle show all floating FX except mixer..."
return




This automatically makes always on top - Windows which names are matching with the FX_Windows GroupAdd names.

It is active only when the WinGroup is active and triggered by mouse left click anywhere. It works as soon as you activate a FX windows.
The only confusing part is that it doesnt showup on the Reaper's AlwaysOnTop PIN. It doesnt affect the graphic of that PIN so it still looks un-pinned
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-09-2018 at 06:25 AM.
D Rocks is offline   Reply With Quote
Old 08-09-2018, 06:54 AM   #13
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

You know what, after spending the morning experimenting with solutions for this issue. I end up thinking that your first method is best because it doesnt introduce bad side-effects like with my autohotkey script.

How could you make your first method be a toggle action? Lets say you want to press the keycommand again to bring back the mixer front without loosing your FX windows. Then press it again to move mixer back again?

I know how to do it in Autohotkey but what would it be in your great Lua script?

The advantage of having your sccript over the "Toggle show all Floating FX..." is that it wouldnt need to recreate windows so its faster
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-09-2018 at 07:40 AM.
D Rocks is offline   Reply With Quote
Old 08-09-2018, 08:42 AM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,915
Default

Does this work for scripts windows too ?
I.e. would it solve this ?

https://forum.cockos.com/showthread.php?t=143012

(didn't get around to test myself yet)
nofish is offline   Reply With Quote
Old 08-10-2018, 03:23 PM   #15
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

hi again Julian

here is an update of testing solutions for an optimal workflow in the Mixer vs FX windows.

So I have tried your script and combined the use of Autohotkey and Reaper actions to get as close as possible to best workflow according to how I see it.

- Autohotkey script detects new active FX windows and sets them always on top automatically following a SetTimer loop. This works when you open FXs one by one. Problem is that because its always on top, it can interfere with other windows like the Windows Explorer or if you need to go on another non-reaper window. It also don't work currently when I use the SWS action "Toggle show all floating FX windows except mixer" because when it recalls the windows, they dont get activated so they dont get the Always on top modification from AHK.

- The SWS action "Toggle show all floating FX windows except mixer" is good when you want to tweak a parameter in the mixer without loosing openned FXs. But the problem is that if you need to do this to show the mixer and add a new FX window, it will overwrite all your previous FX with the newly oepened one.

- Your script with the keycommand would be perfect with a toggle option, and an additionnal feature to make opened FX remain on top - even while opening them one by one, so that the first dont get hidden behind the mixer until you trigger the script.
In more details, the first step of the Toggle would be to bring the mixer back so that it reveals any hidden FX like it currently does perfectly. The 2nd step would be to inversly bring the mixer front to hide all FX behind it temporarily until the user trigger the script again to bring mixer back behind FXs.

Please let me know what you think and ask me anything, I really want to help to get a super efficent workflow for all of us who have struggled with this issue.

thanks man


To better illustrate the Always on top difference with and without Autohotkey here are two .gif files.

1: no Autohotkey script = no always on top. result is that FX get hidden one after the other when you open them from the mixer.
https://stash.reaper.fm/34085/no%20AHK.gif

2: with AHK script making new opened FX always on top. result is that FX windows dont get hidden when you open them one by one from the mixer. which is in my opinion very desirable. PS: You dont graphically see the always on top PIN but it really is always on top.
https://stash.reaper.fm/34086/AHK.gif
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-10-2018 at 03:49 PM.
D Rocks is offline   Reply With Quote
Old 08-11-2018, 01:31 AM   #16
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by nofish View Post
Does this work for scripts windows too ?
I.e. would it solve this ?

https://forum.cockos.com/showthread.php?t=143012

(didn't get around to test myself yet)
I think so!

Try this:
Code:
function loop()
    -- Keep window on top, with flags 0x0010 = NO_ACTIVATE, 0x0040 = SHOW_WINDOW
    reaper.Window_SetZOrder(w, "TOP", w, 0x0010 | 0x0040)
    -- Rest of the deferred loop
    reaper.defer(loop)
end

reaper.atexit(gfx.quit)

gfx.init("My unique title", 100, 100, 0, 100, 100)
w = reaper.Window_Find("My unique title", true)
if w then loop() end
juliansader is offline   Reply With Quote
Old 08-11-2018, 05:21 AM   #17
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,496
Default

@juliansader
Is it possible to set scrollbar positions with these functions?
I noticed that it's possible to get scrollbar positions:

Code:
arrange_identifier =  reaper.Window_Find("trackview", true)
ar_vsb_retval, ar_vsb_position, ar_vsb_page, ar_vsb_min, ar_vsb_max, ar_vsb_trackPos = reaper.Window_GetScrollInfo(arrange_identifier, "v")
SetScrollPos function:
https://docs.microsoft.com/en-us/win...r-setscrollpos
spk77 is offline   Reply With Quote
Old 08-11-2018, 05:59 AM   #18
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by spk77 View Post
Is it possible to set scrollbar positions with these functions?SetScrollPos function:
https://docs.microsoft.com/en-us/win...r-setscrollpos
This is something I would also like to do, but I haven't figured it out yet: WDL/SWELL/CoolScrollBar: How to zoom windows?.

I can set the scroll*bar* position, but the window itself doesn't update.


BTW, I have uploaded a new version of the test build, with some GDI functions and a small bug fix in SetZOrder.
juliansader is offline   Reply With Quote
Old 08-11-2018, 06:20 AM   #19
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,496
Default

Quote:
Originally Posted by juliansader View Post
This is something I would also like to do, but I haven't figured it out yet: WDL/SWELL/CoolScrollBar: How to zoom windows?.

I can set the scroll*bar* position, but the window itself doesn't update.
That would be really handy...let's hope there's an easy fix/solution for that.

Quote:
Originally Posted by juliansader View Post
BTW, I have uploaded a new version of the test build, with some GDI functions and a small bug fix in SetZOrder.
Downloaded, thanks!
spk77 is offline   Reply With Quote
Old 08-11-2018, 11:37 PM   #20
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,496
Default

Maybe this helps?

https://github.com/reaper-oss/sws/bl...pp#L2438-L2457
Code:
void ScrollToTrackIfNotInArrange (MediaTrack* track)
{
	int offsetY;
	int height = GetTrackHeight(track, &offsetY);

	HWND hwnd = GetArrangeWnd();
	SCROLLINFO si = { sizeof(SCROLLINFO), };
	si.fMask = SIF_ALL;
	CoolSB_GetScrollInfo(hwnd, SB_VERT, &si);

	int trackEnd = offsetY + height;
	int pageEnd = si.nPos + (int)si.nPage + SCROLLBAR_W;

	if (offsetY < si.nPos || trackEnd > pageEnd)
	{
		si.nPos = offsetY;
		CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, true);
		SendMessage(hwnd, WM_VSCROLL, si.nPos << 16 | SB_THUMBPOSITION, NULL);
	}
}
spk77 is offline   Reply With Quote
Old 08-18-2018, 12:31 PM   #21
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by spk77 View Post
Maybe this helps?
Unfortunately this example only scrolls, not zooms -- and it is the zooming that I can't get to work.
juliansader is offline   Reply With Quote
Old 08-18-2018, 02:55 PM   #22
VedFerrer
Human being with feelings
 
Join Date: Oct 2013
Posts: 11
Default

im use this autohotkey code:

settimer,vstfocus,1000

vstfocus:
if winexist("VST:")or winexist("VSTi:")or winexist("x86 bridged")or winexist("JS:")and winactive("Mixer")
{
Winget,vedvstfoco,List,VST:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,JS:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,VSTi:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,x86 bridged
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}}
return



pd:input fx chain disable in my case
VedFerrer is offline   Reply With Quote
Old 08-18-2018, 03:13 PM   #23
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

hey Julian,
in the code you shared, is the function "INSERT_AFTER" a new addition to your SWS test build?

If yes can you please share some advice on what it does and if it has a inverse action like INSERT_BEFORE or something similar?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 08-18-2018, 03:14 PM   #24
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 443
Default

Quote:
Originally Posted by VedFerrer View Post
im use this autohotkey code:

settimer,vstfocus,1000

vstfocus:
if winexist("VST:")or winexist("VSTi:")or winexist("x86 bridged")or winexist("JS:")and winactive("Mixer")
{
Winget,vedvstfoco,List,VST:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,JS:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,VSTi:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,x86 bridged
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}}
return



pd:input fx chain disable in my case

nice man thanks for sharing. Can you please tell me more about its functions?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 08-18-2018, 03:28 PM   #25
VedFerrer
Human being with feelings
 
Join Date: Oct 2013
Posts: 11
Default

update the timer function for more windows:



if winexist("VST:")or winexist("VSTi:")or winexist("x86 bridged")or winexist("JS:")or winexist("Actions")or winexist("FX: Track")or winexist("Actions")or winexist("Add FX to: Track")or winexist("Parameter Modulation/Link")or winexist("MIDI/OSC Learn")or winexist("Browse packages")and winactive("Mixer") ;AUTOFOCOFVST INI
{
Winget,vedvstfoco,List,VST:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,JS:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,VSTi:
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,x86 bridged
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
Winget,vedvstfoco,List,FX: Track
{loop,%vedvstfoco%
{ vstfocoloop:=vedvstfoco%A_Index%
WinGetTitle,vedvstfoco,ahk_id %vstfocoloop%
if vedvstfoco contains input FX chain
continue
WinGet,ExStylevst,ExStyle,%vedvstfoco%
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,%vedvstfoco%
}}
WinGet,ExStylevst,ExStyle,Actions
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,Actions
WinGet,ExStylevst,ExStyle,Add FX to: Track
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,Add FX to: Track
WinGet,ExStylevst,ExStyle,Parameter Modulation/Link
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,Parameter Modulation/Link
WinGet,ExStylevst,ExStyle,MIDI/OSC Learn
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,MIDI/OSC Learn
WinGet,ExStylevst,ExStyle,Browse packages
ifnotequal,ExStylevst,0x00010188
winset,alwaysontop,on,Browse packages
} ;AUTOFOCOFVST FIN

Last edited by VedFerrer; 08-18-2018 at 03:35 PM.
VedFerrer is offline   Reply With Quote
Old 08-18-2018, 03:34 PM   #26
VedFerrer
Human being with feelings
 
Join Date: Oct 2013
Posts: 11
Default

Quote:
Originally Posted by D Rocks View Post
nice man thanks for sharing. Can you please tell me more about its functions?
sorry for my inglish,in atvance:

the function,loops the number of vst,js,etc windows,and get status only with mixer windows active,if status not is alwaysontop,loop active this window,from reduce working script.
VedFerrer is offline   Reply With Quote
Old 08-18-2018, 03:51 PM   #27
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,659
Default

Quote:
Originally Posted by D Rocks View Post
hey Julian,
in the code you shared, is the function "INSERT_AFTER" a new addition to your SWS test build?

If yes can you please share some advice on what it does and if it has a inverse action like INSERT_BEFORE or something similar?
Yes, it is only in the test build, not in the latest release version. The most complete info is the documentation of the corresponding C++ function, SetWindowPos.

For cross-platform compatibility, the API function offers three of the five Z order options: "INSERT_AFTER", "HWND_BOTTOM" or "HWND_TOP". Unfortunately (even in the original C++ function) there is not an inverse action.

In INSERT_AFTER mode, the first window in the function's parameters (the mixer window, in the original example) will be positioned after the second window in the Z order.
juliansader is offline   Reply With Quote
Old 11-12-2018, 12:12 AM   #28
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Location: Croatia
Posts: 2,113
Default

You can also use python if you install pywin32 (google pip install pywin32 once you confirm you have python for REAPER installed...the easiest way to install packages is using command line with pip command)

For example, if you assign this to shortcut, it will put mixer window behind all windows except the main window.

Code:
from win32gui import FindWindowEx, GetParent, SetWindowPos
from win32con import SWP_NOMOVE, SWP_NOSIZE, SWP_NOACTIVATE
from reaper_python import *

def GetFloatingMixerHwnd (mainHwnd):
	hwnd = FindWindowEx(0, 0, "#32770", "Mixer")
	while (hwnd):
		if (GetParent(hwnd) == mainHwnd):
			break
		else:
			hwnd = FindWindowEx(0, hwnd, "#32770", "Mixer")

	return hwnd

def Main ():
	mainHwnd  = int(RPR_GetMainHwnd().replace("(HWND)", ""), 16)
	mixerHwnd = GetFloatingMixerHwnd(mainHwnd)
	if mixerHwnd != 0:
		SetWindowPos(mixerHwnd, mainHwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE)

Main()
Breeder is offline   Reply With Quote
Old 04-20-2019, 04:22 PM   #29
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,255
Default

Another possible solution using SWS extension, in Lua script,..

Code:
-- Move floating Mixer window to the back when not the focused window
-- SWS v2.10.0.1

SWP_NOSIZE=0x0001 SWP_NOMOVE=0x0002 SWP_NOACTIVATE=0x0010
flags=SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE
reaMain=reaper.BR_Win32_HwndToString(reaper.GetMainHwnd())
prev=nil

function MainLoop()
  local hwnd = reaper.BR_Win32_GetForegroundWindow()
  if hwnd and hwnd ~= prev then -- foreground window changed.
    prev = hwnd
    local ret, txt = reaper.BR_Win32_GetWindowText(hwnd)
    if ret ~= 0 and txt ~= "Mixer" then
      local mixer = reaper.BR_Win32_FindWindowEx("0", "0", "", "Mixer", false, true)
      if mixer then
        reaper.BR_Win32_SetWindowPos(mixer, reaMain, 0, 0, 0, 0, flags)
      end
    end
  end
  reaper.defer(MainLoop)
end

MainLoop()

Last edited by Edgemeal; 04-20-2019 at 04:41 PM. Reason: re-post function
Edgemeal is offline   Reply With Quote
Old 04-25-2019, 09:35 AM   #30
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,754
Default

just wondering...

I have dual screens and don't have a problem with the mixer really

I mostly keep it docked at left of TCP as a track inspector and when I want a mixer I've been using Heda's VIP mixer which is great and getting better all the time.
I do have a screenset that gives me the the MCP on the other monitor full screen but since the Heda VIP I don't need that often.

OK ... I do wonder if something like this can help with the MIDI Ed. window which really is screwy when it comes to it hiding other windows that show up behind it. Even things like customizing one the MIDI Ed. toolbars and getting into actions list is not a logical thing as regards which window is on top.
Similar issues with MIDI Ed. toolbars when they are made to float.
They too can fall behind the ME and we have to go digging for them... which really makes zero sense... even if we pin them they don't stay on top of the ME window...

So, again... wondering if this kind of coding might apply to these issues?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 04-25-2019, 08:24 PM   #31
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,255
Default

Quote:
Originally Posted by hopi View Post
OK ... I do wonder if something like this can help with the MIDI Ed.
Same code idea but for active midi window..

Code:
-- Move floating MIDI Editor window to the back when not the focused window
-- SWS v2.10.0.1

SWP_NOSIZE=0x0001 SWP_NOMOVE=0x0002 SWP_NOACTIVATE=0x0010
flags=SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE
reaMain=reaper.BR_Win32_HwndToString(reaper.GetMainHwnd())
prev=nil

function MainLoop()
  local hwnd = reaper.BR_Win32_GetForegroundWindow()
  if hwnd and hwnd ~= prev then -- foreground window changed.
    prev = hwnd
    local reaME = reaper.MIDIEditor_GetActive()
    if reaME and hwnd ~= reaME then 
      reaper.BR_Win32_SetWindowPos(reaME, reaMain, 0, 0, 0, 0, flags)
    end 
  end
  reaper.defer(MainLoop)
end

MainLoop()
Edgemeal is offline   Reply With Quote
Old 04-26-2019, 08:25 AM   #32
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,754
Default

Thank you Edge... I'd give it a try

OK back with my results:

hmmm well it 'works' but not really enough to solve the real problem...

let's say we have something like this... now I have it on dual monitors so it's all on the right hand screen
I have the MIDI Ed open and also have a MIDI toolbar floating on top of it...
I can clk in the TB ok, but if I clk on the ME window it hides the TB behind it...

I can then run the action and make the ME window go to the back but that is not really enough, because
clk'ing on it again just hides the TB again...

So the lua is a little handy in that it does move the ME window back for the moment
which saves me sliding it away to get at the floating TB...
BUT this just becomes an endless repeating sillyness...

What I'd love to see is a way to keep the floating TB or other lua GUI or whatever
on top of the ME window, even when I clk in the ME window to do edits.

I think, considering reaper's ways of doing stuff, the problem is really with how the ME
is coded compared with the arrange window...

In the arrange we can have things docked top, bottom, left and right.. but that is not true
in the ME. We can have the toolbar at the top, but nowhere else.
Even then we don't have tabs for that toolbar as we can have in the arrange window.
All this could be a lot better if the DEV's were to take it on. I hope they do!
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 04-26-2019 at 09:21 AM.
hopi is online now   Reply With Quote
Old 07-17-2019, 11:13 AM   #33
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 1,928
Default

Sounds like a great idea, Julian.

Do you think the script would also be able to solve this, too?:

Summary:
When you click on an insert in the MCP that's already open (but hidden behind the MCP or other plugins), the plugin is closed.

Solution:
If plugin GUI is closed, open it.
If plugin GUI is open, bring it to the front.



(https://forum.cockos.com/showthread.php?t=215017)
__________________
Dax Liniere
London's newest premium studio complex! (Facebook)
[i7-4790K, 12Gb RAM, Win8.1x64, NVidia GT710, UAD2-OCTO, FireFaceUFX, REAPER x64]
daxliniere 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 09:45 PM.


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