Old 01-19-2020, 10:50 AM   #1
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default Dfk's Hotkey Script (v.62)

Disclaimer:
Test/use my scripts at your own risk. While it is atypical that a REAPER Lua script would damage or harm your hardware/software/data, I will not accept any liability if this were to occur. The download, installation, and operation of my scripting code and its structures are strictly an operative of free will, and signify an agreement to these terms. You are responsible for any damages that might occur, however unlikely. All my scripts are licensed as GPL v.3.

Install:

Ensure that both files are put in the same folder (i.e., your scripts folder would be ideal).

Description:

With this script you can completely externalize all of your hotkeys from REAPER. All hotkeys are saved to a .txt file in the same folder as the script files themselves. This text document cay be manually edited, backed up, and transported at your leisure. Each hotkey can be assigned to different 'contexts': "Arrange", "Global", "MIDI", et cetera. These contexts determine when each hotkey can be activated (for example: if MIDI, a MIDI editor window has to be open, and have keyboard/mouse focus in order for the hotkey to activate).

Requirements:

js_ReaScriptAPI (v.993 used in development)

Note
Script GUI must be open at all times in order for hotkeys to activate!
Attached Files
File Type: lua Dfk_GUI_Functions.lua (29.8 KB, 185 views)
File Type: lua Dfk Hotkey Script.lua (53.0 KB, 185 views)
__________________

Support my feature request!

Last edited by Dafarkias; 01-26-2020 at 02:51 AM.
Dafarkias is offline   Reply With Quote
Old 01-19-2020, 10:51 AM   #2
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

__________________

Support my feature request!

Last edited by Dafarkias; 01-19-2020 at 11:03 AM.
Dafarkias is offline   Reply With Quote
Old 01-19-2020, 10:52 AM   #3
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Changelog:


[v.5]
  • (script release)

[v.6]
  • Added many more virtual keys to script. (There's around 96 unique keys available now)
  • Added ability to create hotkeys with up to two modifiers. (Ex.: Ctr+a or Ctr+Shf+c)
  • Changed method of altering a hotkey's context. (New method is a popup-menu)
  • Fixed bug for when deleting multple hotkeys from script. (confirmation menu would appear multiple times)
[v.6qf]
  • Fixed issue with modifiers causing error.
[v.61]
  • Added action input "exit", so that a hotkey can cause the script to exit itself.
[v.62]
  • hotkeys are no longer activated when the action window has focus.
  • fixed bug with manually setting a 'hotkey action'.
__________________

Support my feature request!

Last edited by Dafarkias; 01-25-2020 at 01:54 PM.
Dafarkias is offline   Reply With Quote
Old 01-19-2020, 11:42 AM   #4
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Seems useful for me, when I assign it to launch Radial Menu script (by Lokasenna) in the midi editor - it works as expected, but when I press the same shortcut in the arrange view - it opens and closes Radial Menu immidiately. Can you check this behaviour?
Skorobagatko is offline   Reply With Quote
Old 01-19-2020, 12:20 PM   #5
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Skorobagatko View Post
Seems useful for me, when I assign it to launch Radial Menu script (by Lokasenna) in the midi editor - it works as expected, but when I press the same shortcut in the arrange view - it opens and closes Radial Menu immidiately. Can you check this behaviour?
Confirmed. Should be fixed now.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-19-2020, 03:56 PM   #6
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 10,271
Default

Cool, so could this apply to hard-coded actions as in the fx chain window or just regular actions in the regular sections?

My only suggestion so far would be to remove the redundant text (input, hotkey), expand the horizontal size of the input fields and use labeled check-boxes for the sections.
__________________
foxyyymusic
foxAsteria is online now   Reply With Quote
Old 01-20-2020, 12:46 AM   #7
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Those are good suggestions. The check boxes for section are a really good idea. I might actually use a pop-up menu.

Last night before I went to bed I was working on adding all keys to work as a hotkey, and up to two modifiers, so it will be similar to REAPER's native system. I had some success, but definitely still work to do.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-20-2020, 11:09 AM   #8
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by foxAsteria View Post
Cool, so could this apply to hard-coded actions as in the fx chain window or just regular actions in the regular sections?
Is there a reason why this script wouldn't work when focused on a FX chain window? TBH I haven't tested that at the moment.

The "Global" context, in theory, should work. Whether or not it does I haven't yet tested.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-20-2020, 12:12 PM   #9
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 10,271
Default

Quote:
Originally Posted by Dafarkias View Post
Is there a reason why this script wouldn't work when focused on a FX chain window? TBH I haven't tested that at the moment.
Fx chain just has it's own shortcuts that can't be altered and they override other assignments when the window is open, and also has some options to pass through hotkeys or not. So I imagine it would work as long as it could detect when fx chain is focused and translate accordingly.

I haven't actually tried your script yet, as I have way too many assignments already to start reconfiguring them but was just curious about how this might get around the fx chain issue.

I guess an extra handy feature for folks like me would be if it had the ability to detect the current assignments and save them as a text file for hotswapping? I see this script as being most useful to people sharing a system, who need to switch hotkey sets often.
__________________
foxyyymusic
foxAsteria is online now   Reply With Quote
Old 01-20-2020, 01:06 PM   #10
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Sharing a system, or people that use REAPER over multiple machines, or use a portable install (I use a portable install, actually).

I suppose I could look into how this script could acquire whatever native hotkeys are installed in a user's REAPER config. Mespotine would probably be the person I'd ask about that.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-20-2020, 04:04 PM   #11
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

I get this, when assing a shortcut (W), which opens Radial Menu script in midi editor:

...\AppData\Roaming\REAPER\Scripts\Dfk Hotkey Script.lua:1109: bad argument #1 to 'byte' (number expected, got string)

Maybe it would help - the same (W) shortcut for this action I have for "Main" section.

edit: tested it with modifier - same result.
Skorobagatko is offline   Reply With Quote
Old 01-21-2020, 08:26 AM   #12
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Let me double check something and get back to you on that.

[Edit]

Are you saying that you already have 'w' assigned to an action using REAPER's native system?

Could you please post the contents of the Dfk Hotkey Script.txt file, please? It's in whatever folder you've placed my script.
__________________

Support my feature request!

Last edited by Dafarkias; 01-21-2020 at 08:34 AM.
Dafarkias is offline   Reply With Quote
Old 01-21-2020, 09:10 AM   #13
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Here you go: https://www.dropbox.com/s/yp11ez7jcm...cript.txt?dl=0
Skorobagatko is offline   Reply With Quote
Old 01-21-2020, 10:36 AM   #14
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

It's empty?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-21-2020, 10:37 AM   #15
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
It's empty?
check one more time
Skorobagatko is offline   Reply With Quote
Old 01-21-2020, 10:50 AM   #16
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Mmmm. That's the actual script file.

Can we try this again, somehow? Do you get the error still if you create a new hotkey for an action other than Radial Menu?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-21-2020, 11:25 AM   #17
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Oops, sorry!

Think I figured out the problem. Please hang tight for a fix. I'll try to have it uploaded tomorrow!
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-25-2020, 02:52 AM   #18
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

quick fix posted. Was a simple error.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-25-2020, 05:16 AM   #19
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
quick fix posted. Was a simple error.
Yeah! It's working, now I can open Lokasenna's Radial Menu while my fx (for example synth) plugin is in focus (floated), which was impossible without your script. Thank you!

Is it possible to assign a shortcut to kill the script when needed? For example to "ESC" key?

And can you add a feature so it would remember a dock state (so that I could have it already docked when I open it?)

Last edited by Skorobagatko; 01-25-2020 at 09:27 AM.
Skorobagatko is offline   Reply With Quote
Old 01-25-2020, 09:55 AM   #20
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Try it now?

[Edit]

On my PC it does remember whether or not the window was docked by the user. You're not experiencing that behavior?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-25-2020, 10:05 AM   #21
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Also one thing that's worth mentioning is that whatever hotkey is assigned to globally will trigger even when typing a FX name into your FX panel, or when typing into your action list.

For instance, if you have 't' assigned to insert a track (globally), and you type "mute track" into your action list, the 't' will actually trigger the hotkey action and insert a track.

^^^^ I'm working on a fix for this, so global will ignore the action list. Also, I'm going to add a secondary 'global' setting that will ignore any FX panel that is open.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-25-2020, 11:03 AM   #22
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
Try it now?

[Edit]

On my PC it does remember whether or not the window was docked by the user. You're not experiencing that behavior?
It remembers it when I dock it, close and open again in my project. But when I close Reaper itself and launch it again - script opens undocked.

Quote:
Originally Posted by Dafarkias View Post
^^^^ I'm working on a fix for this, so global will ignore the action list. Also, I'm going to add a secondary 'global' setting that will ignore any FX panel that is open.
That's great!
Skorobagatko is offline   Reply With Quote
Old 01-25-2020, 11:53 AM   #23
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Skorobagatko View Post
It remembers it when I dock it, close and open again in my project. But when I close Reaper itself and launch it again - script opens undocked.
Hmmmm.

It sounds like the reaper.atexit function I'm using is acting up whenever you close REAPER. I can look into if there is a fix.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 08-20-2020, 06:53 AM   #24
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Hi Dafarkias. Hope you're doing well.

Any chance to look at remembering the dock position of the script after restarting Reaper?
Skorobagatko is offline   Reply With Quote
Old 11-19-2020, 03:32 PM   #25
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Any progress on this?
Skorobagatko is offline   Reply With Quote
Old 11-20-2020, 08:37 AM   #26
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

I'm not sure why the exit function isn't triggering when you close the REAPER. You could hard code the script to always start in a certain dock mode
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 11-20-2020, 09:36 AM   #27
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
I'm not sure why the exit function isn't triggering when you close the REAPER. You could hard code the script to always start in a certain dock mode
How to do this? What line should I edit in the code?
Skorobagatko is offline   Reply With Quote
Old 11-20-2020, 10:53 AM   #28
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
Default

Just saw this, now we have following similar tools.
- this
- vimper
- reaper keys
https://gwatcha.github.io/reaper-key...mposition.html
- there was another vimper like variant

I was using so far mostly vimper, reaper keys looks very promising, wanted to try this a bit. It would be always cool if such tools could exist somehow in parallel without having to decide for one variant. I should be able to switch into a mode, e..g this mode, vimper mode, reaper keys mode and would use that system in that mode.

Anyway, cool we have so many interesting options, thanks for sharing.

Why did you develop your own variant? Any example setups or how you are using it?
TonE is offline   Reply With Quote
Old 11-21-2020, 03:46 PM   #29
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Idk. I sure as hell don't use it.

Yes there are examples on how to use it. Read the first few posts
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 11-21-2020, 03:56 PM   #30
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Skorobagatko View Post
How to do this? What line should I edit in the code?
Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end
Find this line. It's line 667. Change it to this:

Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end d = 1
If you want the script to start undocked then change the 1 to 0
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-08-2021, 06:41 AM   #31
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end
Find this line. It's line 667. Change it to this:

Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end d = 1
If you want the script to start undocked then change the 1 to 0
It sticks to the bottom dock, how to make it appear on the left?
Skorobagatko is offline   Reply With Quote
Old 01-08-2021, 08:32 AM   #32
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

You can't drag the docked window to the left position?

Or is it just not remembering the position if you do?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-08-2021, 09:02 AM   #33
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
You can't drag the docked window to the left position?

Or is it just not remembering the position if you do?
It doesn't remember the position. I drag it to the left docker, then it appears in bottom one after I close and open it again.
Skorobagatko is offline   Reply With Quote
Old 01-10-2021, 09:29 AM   #34
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Interesting. My understanding was that REAPER stores dock information for script windows, but apparently not. I'm guessing that you might have to fiddle around with the dock input number until it assigns the window to your left pane.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-10-2021, 11:19 AM   #35
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
Interesting. My understanding was that REAPER stores dock information for script windows, but apparently not. I'm guessing that you might have to fiddle around with the dock input number until it assigns the window to your left pane.
How to find this number in the script?
Skorobagatko is offline   Reply With Quote
Old 01-11-2021, 12:01 PM   #36
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Skorobagatko View Post
How to find this number in the script?
Line 667.

Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end d = 1
You'll need to play with the "d=1" and see if that fixes the dock origin issue, e.g., try 2, 3, 4, etc.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-11-2021, 12:30 PM   #37
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
Line 667.

Code:
if reaper.HasExtState( "Dfk Hotkey", "W_D" ) then d = reaper.GetExtState( "Dfk Hotkey", "W_D" ) end d = 1
You'll need to play with the "d=1" and see if that fixes the dock origin issue, e.g., try 2, 3, 4, etc.
I tried, it doesn't work that way.
Skorobagatko is offline   Reply With Quote
Old 01-12-2021, 07:39 AM   #38
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

May I use your disclaimer in my scripts please ? Great idea. I'll also add to have backups of your data before testing.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 01-12-2021, 08:30 AM   #39
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

@Coachz Knock yourself out.

@Skorobagatko I'm not sure why you're experiencing this behavior. I think we were talking early and you mentioned that the script only didn't remember your dock-state when you closed REAPER with the script running, is that correct?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 01-12-2021, 09:02 AM   #40
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Dafarkias View Post
@Coachz Knock yourself out.

@Skorobagatko I'm not sure why you're experiencing this behavior. I think we were talking early and you mentioned that the script only didn't remember your dock-state when you closed REAPER with the script running, is that correct?
Yes, after I changed a number from 0 to 1, like you suggested - it remembers the dock position (dock at bottom), but I need it to appear in another dock (to the left).
Skorobagatko 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 10:14 PM.


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