Old 01-29-2015, 04:45 PM   #1
jrp
Human being with feelings
 
Join Date: Nov 2014
Posts: 149
Default force focus arrange : is a defer script like this good practice?

Hello,
Today i tried, for the first time, to use the defer function.

I am always annoyed that as soon as any window other than the arrange window has focus, my custom key-shortcuts won´t work.
I would like to have my arrange window active at all time.
I tried this little script and it does work. FX parameters can still be tweaked just normal.
Very very happy about this!
Still i have a feeling that this might be a stupid way to do this. Brutal and maybe hard hitting on system performance? Just a "gut-feel", so please comment
Code:
function main()
(
    Main_OnCommand(NamedCommandLookup("_BR_FOCUS_ARRANGE_WND"), 0);
    defer("main()");
);        
main();
jrp is offline   Reply With Quote
Old 01-29-2015, 04:51 PM   #2
jrp
Human being with feelings
 
Join Date: Nov 2014
Posts: 149
Default

to answer myself:

Like this, the script is rather stupid.

As soon as you try to enter any text anywhere you notice...

So i should at least see that the focus arrange action is only triggered if a fx window has focus.
-unfortunately, i see no way to do that...

Last edited by jrp; 01-29-2015 at 05:01 PM.
jrp is offline   Reply With Quote
Old 01-31-2015, 08:11 AM   #3
jrp
Human being with feelings
 
Join Date: Nov 2014
Posts: 149
Default

there is a command
GetFocusedFX
(Int retval, Int tracknumberOut, Int itemnumberOut, Int fxnumberOut) = RPR_GetFocusedFX(tracknumberOut, itemnumberOut, fxnumberOut)

maybe this would be the key?
I have no idea how to use it though.
How can i learn this stuff?
Whenever i look up a command and cannot find an excample i´m lost...
jrp is offline   Reply With Quote
Old 01-31-2015, 02:18 PM   #4
kuus0
Human being with feelings
 
Join Date: Feb 2011
Posts: 159
Default

Quote:
Originally Posted by jrp View Post
there is a command
GetFocusedFX
(Int retval, Int tracknumberOut, Int itemnumberOut, Int fxnumberOut) = RPR_GetFocusedFX(tracknumberOut, itemnumberOut, fxnumberOut)

maybe this would be the key?
I have no idea how to use it though.
How can i learn this stuff?
Whenever i look up a command and cannot find an excample i´m lost...
Try this:
Code:
retval = GetFocusedFX(track_num, item_num, fx_num);
// variables track_num, item_num, fx_num now contain the wanted info
Here's the documentation:

Quote:
Returns 1 if a track FX window has focus, 2 if an item FX window has focus, 0 if no FX window has focus. tracknumber==0 means the master track, 1 means track 1, etc. itemnumber and fxnumber are zero-based. See GetLastTouchedFX.
So you probably want to focus the arrange view only when retval > 0.

Last edited by kuus0; 01-31-2015 at 03:26 PM. Reason: retval > 0, not retval >= 0
kuus0 is offline   Reply With Quote
Old 02-02-2015, 02:39 AM   #5
jrp
Human being with feelings
 
Join Date: Nov 2014
Posts: 149
Default

i don´t get any values out of this.
With something like ShowConsoleMsg(fx_num) i get an empty console...

problem is: when selecting presets or adding fx the defer script needs to be off as well.

So for now i have added a dummy toggle button (assigned to a keycommand) to turn this functionality on or off.

It seems like this is no big stress on cpu or system performance.
Code:
function main()
(
    a = GetToggleCommandState(NamedCommandLookup("_S&M_DUMMY_TGL1"));
    a == 1 ? Main_OnCommand(NamedCommandLookup("_BR_FOCUS_ARRANGE_WND"), 0);
    defer("main()");
);        
main();
jrp is offline   Reply With Quote
Old 02-02-2015, 04:08 AM   #6
kuus0
Human being with feelings
 
Join Date: Feb 2011
Posts: 159
Default

Try this:
PHP Code:
function main()
(
    (!(
100)) ? (
      
retval GetFocusedFX(track_numitem_numfx_num);
      
// variables track_num, item_num, fx_num now contain the wanted info                                             
      
ShowConsoleMsg(sprintf(#, "retval: %d, track_num: %d, item_num: %d, fx_num: %d\n", retval,track_num, item_num, f\
x_num));
    );
    
i+=1;
    
defer("main()");
);
main(); 
I never got retval of 0, only 1 or 2. Maybe a bug in GetFocusedFX, or just a bug in documentation.
kuus0 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 03:58 PM.


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