|
|
|
03-20-2019, 12:27 PM
|
#321
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by mespotine
Big big thanks
|
FWIW, when sending messages to change controls they may just update the control display, seems many of the controls are tied to Key/Mouse Click and MouseWheel events. Like my script that changed the index of the FX Presets combobox so I could read the preset names, REAPER doesn't do anything when I changed the index, only the text in the combobox is changing.
EDIT Fixed!
See post #342,
https://forum.cockos.com/showpost.ph...&postcount=342
Last edited by Edgemeal; 04-25-2022 at 11:54 AM.
|
|
|
03-21-2019, 07:12 AM
|
#322
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by Edgemeal
FWIW, when sending messages to change controls they may just update the control display, seems many of the controls are tied to Key/Mouse Click and MouseWheel events. Like my script that changed the index of the FX Presets combobox so I could read the preset names, REAPER doesn't do anything when I changed the index, only the text in the combobox is changing.
|
Yeah, I noticed already, I need to "click" through a combobox to get the correct index.
This is especially important for the Render to File-dialog, where the format-settings-field's-HWND is only updated that way.
Otherwise, you can't access bitrate-settings and such...
|
|
|
03-22-2019, 08:38 AM
|
#323
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Hi !
Is there any way to get screen size (width and height ?) ? Thx !
|
|
|
03-22-2019, 09:27 AM
|
#324
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
In v0.972 Julian added JS_Window_MonitorFromRect,
JS_Window_MonitorFromRect(int x1, int y1, int x2, int y2, bool wantWork, int* leftOut, int* topOut, int* rightOut, int* bottomOut)
Not exactly sure how to use it, I'm assuming if I just enter 0 for all the params its returning the size of my first monitor, I have 2x 1080p so not sure, but it is returning 1920x1080.
Code:
l,t,r,b = reaper.JS_Window_MonitorFromRect(0,0,0,0,false) -- ,true for workarea only.
Last edited by Edgemeal; 03-23-2019 at 11:08 AM.
|
|
|
03-22-2019, 12:09 PM
|
#325
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@edgemeal
Many thanks!
I am making a script,
and your info was all I needed to make it public
Though, it can still have few features... :P
--
Question:
Is there a function to check if REAPER is in focus (and not another app ?)
And a way to now on which screen is launched REAPER ?
--
@julian
Cfillion told me it would be possible to add a function to return current pressed key, using accelerator_register_t and this code snippet : https://gist.github.com/cfillion/d86...fd7b2ea82f7ff6
Could you merge take a look to add it into js_extension? That would be neat, thanks !
|
|
|
03-22-2019, 01:06 PM
|
#326
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by X-Raym
Question:
Is there a function to check if REAPER is in focus (and not another app ?)
|
Maybe something like,..
Code:
function ReaperHasFocus()
hwnd = reaper.JS_Window_GetForeground() -- may be nil when switching windows, so check it!
if hwnd then
rea_hwnd = reaper.GetMainHwnd()
if hwnd == rea_hwnd or reaper.JS_Window_GetParent(hwnd) == rea_hwnd then
return true
end
end
return false
end
|
|
|
03-22-2019, 01:56 PM
|
#327
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by X-Raym
@julian
Cfillion told me it would be possible to add a function to return current pressed key, using accelerator_register_t and this code snippet
...
Could you merge take a look to add it into js_extension? That would be neat, thanks !
|
What!? It's possible to capture key presses!? I will immediately check it out and add it to the extension.
|
|
|
03-22-2019, 03:04 PM
|
#328
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by juliansader
Is it currently possible to import image files into the media bay?
|
As far as I can tell, image files likes jpg/png are indeed imported in media bay when you import them into project.
Quote:
Originally Posted by mespotine
Screenshot should be possible, but saving it as a file could be a thing.
There's only a LoadPNG-Lice-function, but not a SavePNG-one.
|
But if you use win32 API to take the screenshot, you should be able to use that same API to save it to a file on disk? And then it's a matter of importing that file into REAPER project.
|
|
|
03-23-2019, 02:19 AM
|
#329
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by juliansader
What!? It's possible to capture key presses!? I will immediately check it out and add it to the extension.
|
Yesyesyesyesyes!
Cfillion showed an example in this forum a few weeks ago, that demonstrated it somehow.
Edit:
Here it is https://forum.cockos.com/showthread.php?t=215860
|
|
|
03-23-2019, 03:15 AM
|
#330
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Edgemeal
Many thanks !
You are defintitly the specialist of this extension :P
The only question left for my script: And a way to now on which screen is launched REAPER ? ^^ But maybe JS_Window_MonitorFromRect already take care of that internally.
Maybe it's functions which I haven't yet put in my reascript doc, I'll update that in few minutes.
EDIT: Updated.
Last edited by X-Raym; 03-23-2019 at 03:24 AM.
|
|
|
03-23-2019, 03:26 AM
|
#331
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
|
|
|
03-23-2019, 03:51 AM
|
#332
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by X-Raym
The only question left for my script: And a way to now on which screen is launched REAPER ? ^^ But maybe JS_Window_MonitorFromRect already take care of that internally.
|
First get the rect of REAPER's main window, the use that to get the rect of the screen it is in.
BTW, I think I have chosen a bad name for the MonitorFromRect function. It should have been something like Window_ViewportFromRect.
|
|
|
03-23-2019, 03:58 AM
|
#333
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@juliansader
Ok then my script should already works :P
If you have to change function name, feel free to do it. There shouldn't be a lot of script which use it yet.
|
|
|
03-23-2019, 02:19 PM
|
#334
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by X-Raym
|
Its a cool idea!
How about scrolling Mixer horizontally in similar way,
Testing, Mixer is docked or maximized on monitor 1 or 2.
Code:
-- Scroll Mixer horizontally when mouse reaches edges of screen
-- * Windows only! * - Edgemeal - Mar 23, 2019
scroll_speed = 6 -- number of pixels to move scrollbar per pass.
leeway = 30 -- pixels beyond screen edge for multi-monitor.
function ReaperHasFocus()
local hwnd = reaper.JS_Window_GetForeground() -- may be nil when switching windows, so check it!
if hwnd then
local rea_hwnd = reaper.GetMainHwnd()
if hwnd == rea_hwnd or reaper.JS_Window_GetParent(hwnd) == rea_hwnd then
return true
end
end
return false
end
function Main()
if ReaperHasFocus() then
local mixer, _ = reaper.BR_Win32_GetMixerHwnd()
if mixer then
local _, left, top, right, bottom = reaper.JS_Window_GetRect(mixer)
local mixer_scrn_left, _, mixer_scrn_right, _ = reaper.JS_Window_MonitorFromRect(left, top, right, bottom, false)
local dialog_hwnd = reaper.JS_Window_FindEx(mixer, mixer, '#32770', '')
local _, position, pageSize, min, max, _ = reaper.JS_Window_GetScrollInfo(dialog_hwnd, "SB_HORZ")
local mouse_x, mouse_y = reaper.GetMousePosition()
local newpos = position
if ((mouse_x >= mixer_scrn_right-1) and (mouse_x <= mixer_scrn_right + leeway)) then
newpos = newpos + scroll_speed
if newpos > (max-pageSize) then newpos = (max-pageSize) end
reaper.JS_Window_SetScrollPos(dialog_hwnd, "SB_HORZ", newpos)
elseif ((mouse_x <= mixer_scrn_left) and (mouse_x >= mixer_scrn_left - leeway)) then
newpos = newpos - scroll_speed
if newpos < min then newpos = min end
reaper.JS_Window_SetScrollPos(dialog_hwnd, "SB_HORZ", newpos)
end
end
end
reaper.defer(Main)
end
Main()
Last edited by Edgemeal; 03-23-2019 at 02:35 PM.
Reason: wording
|
|
|
03-23-2019, 04:26 PM
|
#335
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@edgemeal
Yes ! it open lots of navigation possibility for all kind of window. really interesting.
The next big step would be keyboard suppory, so that if I press SHIFT on screen edges, it scrolls faster :]
Also more complex scrolling direction rules (not only orthogonal or diagonal) could be nice but would require more complex math(and maybe the results woulf be less usable). Anyway, nice to brainstorm :P
|
|
|
03-25-2019, 09:41 PM
|
#336
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Quote:
Originally Posted by Edgemeal
See if this works, it first searches the list for where 'User Presets', starts and ends, so if same English text it should work,...
EDIT When I use midi PC message to select say 3rd user preset from this reabank file and FX also has 'VST built-in' presets then the FX uses the 3rd built-in preset. But ReaControlMIDI works fine.
Updated (again)
If no user presets found, notify and exit.
If fx floating window not found, notify and exit.
Fix, if 'VST built-in programs' not found list was empty.
Pad list count with zeros for reabank file.
|
Odds bodkins, that is awesome! I've been asking for this for 5 years!
Thank you!!!!!
|
|
|
03-26-2019, 03:34 PM
|
#337
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Okay, not working for me so far. It is not getting to the vst built-in programs....
Doesn't seem like it is offering any options. I'll look in the code. Is there a flag that needs to be set to get to the built-in programs?
EDIT: Okay, looks like the code isn't supposed to get the built-in programs. That's what I was looking for, though. Might have used some confusing language, as the 'built-in' programs are actually 'mine'
I think the only question I have is how to stop it at the end of the list... but I'll mess around with that. The problem for me was getting to the list in the first place. Perfect homework assignment for my minimal scripting skills!
EDIT: Even easier than that. Already know the list length. This works a charm, and can get either rpls or vst programs, just by changing a couple of lines of code. Perfect!!
Last edited by woodslanding; 03-26-2019 at 03:48 PM.
|
|
|
03-27-2019, 09:42 AM
|
#338
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by Edgemeal
FWIW, when sending messages to change controls they may just update the control display, seems many of the controls are tied to Key/Mouse Click and MouseWheel events. Like my script that changed the index of the FX Presets combobox so I could read the preset names, REAPER doesn't do anything when I changed the index, only the text in the combobox is changing.
|
Maybe helpful for you:
I use the following trick, to make Reaper accept my changes in the ComboBoxes of the Render To File-dialog:
Code:
-- set the new setting in the combobox. Reaper will still ignore these changes:
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd,1116), "CB_SETCURSEL", 1,0,0,0)
-- "click" on the combobox once. Reaper understands accepts these changes now:
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd, 1449), "WM_LBUTTONDOWN", i,i,i,i)
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd, 1449), "WM_LBUTTONUP", i,i,i,i)
Maybe this helps in FX-Preset-comboboxes as well.
|
|
|
03-27-2019, 09:45 AM
|
#339
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by X-Raym
@edgemeal
Yes ! it open lots of navigation possibility for all kind of window. really interesting.
The next big step would be keyboard suppory, so that if I press SHIFT on screen edges, it scrolls faster :]
Also more complex scrolling direction rules (not only orthogonal or diagonal) could be nice but would require more complex math(and maybe the results woulf be less usable). Anyway, nice to brainstorm :P
|
Shift is already possible, using:
https://mespotin.uber.space/Ultrasch...Mouse_GetState
which works like gfx.mouse_cap.
@juliansader
Maybe it is a good idea to add to the docs of JS_Mouse_GetState, that using -1 as flags allows one to get all states at once, which is exactly as gfx.mouse_cap.
Otherwise, one might be stuck with only one setting at a time to get.
|
|
|
03-28-2019, 03:49 AM
|
#340
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@mespotine
Oh thanks !
So this seems to work for shift:
Code:
key = reaper.JS_Mouse_GetState( 8 )
if key == 8 then....
I guess I can simply duplicate the function if I need the other modifier key.
Thx !
Edit: I updated my scroll scripts to handle CTRL and Shift key :P
Last edited by X-Raym; 03-28-2019 at 04:02 AM.
|
|
|
03-28-2019, 09:23 AM
|
#341
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by X-Raym
@mespotine
Oh thanks !
So this seems to work for shift:
Code:
key = reaper.JS_Mouse_GetState( 8 )
if key == 8 then....
I guess I can simply duplicate the function if I need the other modifier key.
Thx !
Edit: I updated my scroll scripts to handle CTRL and Shift key :P
|
You can also pass -1 to get a value, that includes all mousebuttons and all modifiers, so it behaves exactly like gfx.mouse_cap.
Helpful, when checking for combinations.
|
|
|
03-28-2019, 06:27 PM
|
#342
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by mespotine
Maybe helpful for you:
I use the following trick, to make Reaper accept my changes in the ComboBoxes of the Render To File-dialog:
Code:
-- set the new setting in the combobox. Reaper will still ignore these changes:
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd,1116), "CB_SETCURSEL", 1,0,0,0)
-- "click" on the combobox once. Reaper understands accepts these changes now:
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd, 1449), "WM_LBUTTONDOWN", i,i,i,i)
reaper.JS_WindowMessage_Post(reaper.JS_Window_FindChildByID(hwnd, 1449), "WM_LBUTTONUP", i,i,i,i)
Maybe this helps in FX-Preset-comboboxes as well.
|
That only drops the list down, EDIT / UPDATED AFAIK This works on Win and Mac,...
Code:
function SetComboBoxIndex(hwnd, index)
local id = reaper.JS_Window_AddressFromHandle(reaper.JS_Window_GetLongPtr(hwnd, "ID"))
reaper.JS_WindowMessage_Send(hwnd, "CB_SETCURSEL", index,0,0,0)
reaper.JS_WindowMessage_Send(reaper.JS_Window_GetParent(hwnd), "WM_COMMAND", id, 1, reaper.JS_Window_AddressFromHandle(hwnd), 0) -- 1 = CBN_SELCHANGE
end
Last edited by Edgemeal; 04-25-2022 at 11:50 AM.
Reason: Better way to change combo box index in REAPER
|
|
|
03-29-2019, 04:18 AM
|
#343
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I have just uploaded an exciting new version 0.980:
* New JS_VKeys functions for getting and intercepting virtual key / keyboard states.
* New JS_Composite functions for compositing LICE bitmaps into REAPER windows. (Refer to the discussion in Extension API: Link LICE bitmap to REAPER window, for seamless integration into UI. Hopefully we can soon get a native version of these functions.) Doesn't work in Linux yet, but seems to work better in macOS than in Windows. (In Windows, there is still a slight but noticeable glitching when the window is scrolling.) In addition to the obvious applications of drawing informative text or images over windows, themers can use these functions to theme UI elements:
* Enabled alpha blending for GDI blitting.
I haven't updated ReaPack yet, since I would prefer to test the new version a bit more, but anyone who would like to play with the new functions, can download it from GitHub
Last edited by juliansader; 04-11-2019 at 10:50 AM.
|
|
|
03-29-2019, 05:20 AM
|
#344
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
The keyboard feature can be a real game changer !
For the Lice thing, how CPU friendly it is ? isnt it a bit overkill for themers ? ^^
It will open new possibility for sure.
Thanks !
|
|
|
03-29-2019, 05:34 AM
|
#345
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by X-Raym
For the Lice thing, how CPU friendly it is ?
|
As far as I could tell, is is reasonably CPU friendly, since the bitmap only gets blitted when the window itself is being updated, and blitting a quick function. If the script itself does lots of blitting and rotating in each defer cycle (such as the rotating dice above), my CPU usage would rise by about 1-2%.
Quote:
Originally Posted by X-Raym
isnt it a bit overkill for themers ? ^^
|
It's quite easy to do (and AFAIK there is no other way to change the appearance if MIDI editor UI elements): 1) load the bitmap png or, if you only need one color, draw a small solid rectangle bitmap, 2) get the UI element HWND with FindChildByID, 3) composite the two, 4) quit without destroying the bitmap. The extension will keep the bitmap in memory.
|
|
|
03-29-2019, 06:37 AM
|
#346
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Nice and great work, Julian
Another question: can I somehow access the used font in a hwnd and change that? I would love to have a font with a fixed length in the ReaConsole-window for layout-reasons...
|
|
|
04-03-2019, 09:23 AM
|
#347
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by Edgemeal
That only drops the list down, using SendMessage works better, but even that doesn't work 100% (on "DropDownList" style), for example changing the MIDI Quantize settings combo to/from "Use Grid" and "Manual", should resize the window also, sometimes it does, sometimes it doesn't. I'm now testing sending keys (VK_UP, VK_DOWN ) to set set combo index instead and its looking really good!
EDIT
For my presets scripts, setting the 'DropDownList' style combos, this is working perfect,..
Code:
local VK_UP = 0x26
local VK_DOWN = 0x28
function JS_KeyDownUp(hwnd, vk_key)
reaper.JS_WindowMessage_Send(hwnd, "WM_KEYDOWN", vk_key, 0,0,0)
reaper.JS_WindowMessage_Send(hwnd, "WM_KEYUP", vk_key, 0,0,0)
end
function ChangeComboIndex (hwnd, cur_index, new_index)
if new_index > cur_index then
for n = cur_index, new_index-1 do
JS_KeyDownUp(hwnd, VK_DOWN) -- send 'down arrow' key
end
elseif new_index < cur_index then
for n = cur_index-1, new_index ,-1 do
JS_KeyDownUp(hwnd, VK_UP) -- send 'up arrow' key
end
end
end
Usage,
Code:
ChangeComboIndex(hwnd, current_index, new_index)
|
Is it okay, when I put your function into my Ultraschall-API? It could be quite useful for many others as well...
|
|
|
04-03-2019, 10:53 AM
|
#348
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by mespotine
Is it okay, when I put your function into my Ultraschall-API? It could be quite useful for many others as well...
|
Why I post.
|
|
|
04-03-2019, 10:54 AM
|
#349
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Gotta love the community
|
|
|
04-03-2019, 11:39 AM
|
#350
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Quote:
Originally Posted by Edgemeal
See if this works, it first searches the list for where 'User Presets', starts and ends, so if same English text it should work,...
Updated (again)
If no user presets found, notify and exit.
If fx floating window not found, notify and exit.
Fix, if 'VST built-in programs' not found list was empty.
Pad list count with zeros for reabank file.
|
I changed this code to look for the floating window
Code:
--Check that fx window is focused------
local focused,tracknum,_,fx_num = reaper.GetFocusedFX()
--msg('tracknum = '..tracknum)
if focused then
track = reaper.GetTrack(0, tracknum)
_,fx_name = reaper.TrackFX_GetFXName(track, fx_num,"")
msg('fx name = '..fx_name)
end
But I am getting the wrong window name!! It's only a problem on certain tracks.
Any thoughts?
Edit: I even removed the js volume effect from the track entirely. It still shows as the fxname
|
|
|
04-03-2019, 12:31 PM
|
#351
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Okay, tried this on multiple other tracks, and on my desktop.
Sometimes it doesn't return anything at all, but usually some other fx from my project which is on another track in a different slot#.
It's seeming like a crazy fluke that I even got an accurate fx name the first time I did it. I have not been able to get it to work since on any track.
I know the desktop is running the newest version of Reaper.
Bug Report? I'll file one if nobody sees some strange problem with my code....
EDIT: Okay, the number that getFocusedFX returns is 1 based, and the one getTrack method is looking for is ZERO based. Keeps out the riff-raff.
As you were.
Last edited by woodslanding; 04-03-2019 at 12:41 PM.
|
|
|
04-03-2019, 01:08 PM
|
#352
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by woodslanding
As you were.
|
FWIW, this was code I was trying last time I was playing with that same idea,..
Code:
function Main()
local track
local _, track_id, _, fx_id = reaper.GetFocusedFX()
if not track_id or not fx_id then return end
if track_id == 0 then
track = reaper.GetMasterTrack(0)
else
track = reaper.CSurf_TrackFromID(track_id, false)
end
if not track then return end
local _, fx_name = reaper.TrackFX_GetFXName(track, fx_id, '')
local title = reaper.JS_Localize(fx_name, "common")
local hwnd = reaper.JS_Window_Find(title, false)
-- check if window found
if not hwnd then return end
-- show full titlebar text to check if correct window was found,
text = reaper.JS_Window_GetTitle(hwnd)
msg(text)
-- get presets combobox
...
end
|
|
|
04-03-2019, 03:01 PM
|
#353
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
yeah, so csurf makes that conversion for you...
Well, it's all working stunningly now. I created a script to generate reaticulate files, and I can do all my patch changes from the reaticulate window.
I'll post it over in that forum.
|
|
|
04-03-2019, 07:00 PM
|
#354
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
I'm not sure how you guys are figuring out these window commands, but the other thing I would dearly love would be to get access to the 'save preset...' command in the '+' window via keycommand.
I'm looking at saving hundreds if not thousands of presets in the next month or so, as I transfer to reaper as my live host, and that menu is SO tiny and hard to mouse to.
I instinctively reach for a keycommand when it's time to name a preset--but no!
but maybe now, yes???
|
|
|
04-03-2019, 07:51 PM
|
#355
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by woodslanding
I'm not sure how you guys are figuring out these window commands
|
To get Command IDs use MS SPY++ or similar app,
https://forum.cockos.com/showpost.ph...&postcount=171
Code:
BM_CLICK = "0x00F5" -- https://docs.microsoft.com/en-us/windows/desktop/controls/bm-click
if hwnd then -- handle to floating plugin window
local container = reaper.JS_Window_FindChildByID(hwnd, 0) -- controls we want are inside this child window.
local btn = reaper.JS_Window_FindChildByID(container, 1257) -- get handle to plus button
if btn then
reaper.JS_WindowMessage_Send(btn, BM_CLICK, 0,0,0,0) -- click the plus button
end
end
Seems once a context menu or an input dialog is open the script stops running code and only continues when they are closed, not sure how you get around that, multiple scripts maybe?
|
|
|
04-04-2019, 06:26 AM
|
#356
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by woodslanding
I'm looking at saving hundreds if not thousands of presets in the next month or so, as I transfer to reaper as my live host, and that menu is SO tiny and hard to mouse to.
I instinctively reach for a keycommand when it's time to name a preset--but no!
but maybe now, yes???
|
Maybe try with autohotkey...I've used it in the past to automate such goals. Create a simple AHK script that moves the mouse around and sends keyboard commands for copy/paste, naming stuff, pressing ok etc...needs a little trial and error but once done, you can leave your computer turned on and let the script handle all the preset saving. The hardest part was to predict a good pause time in between saving, loading of menus etc...so you never get a miss click or something. Not fun having that happen during final AHK script run. Keep backups!
I remember re-editing over a thousand Kontakt presets by adding custom scripts to those instruments. I calculated it would took over a month to do it manually and in this way it only took a day or so.
It usually looks something like this:
Code:
; Load next instrument, purge it and copy its name
SendInput, i
Sleep 500
WinMove, A, , DEFAULT_INSTRUMENT_POSITION_X, DEFAULT_INSTRUMENT_POSITION_Y
Sleep 100
if (A_Index > 1) ; Don't load first time because it's already loaded
{
MouseClick, left, DEFAULT_KONTAKT_NEXT_PRESET_X, DEFAULT_KONTAKT_NEXT_PRESET_Y, 1, 5
Sleep 1000
}
MouseClick, left, DEFAULT_KONTAKT_PURGE_X, DEFAULT_KONTAKT_PURGE_Y, 1, 5
Sleep 200
MouseClick, left, DEFAULT_KONTAKT_PURGE_ON_X, DEFAULT_KONTAKT_PURGE_ON_Y, 1, 5
Sleep 200
MouseClick, left, DEFAULT_KONTAKT_FIRST_NAME_X, DEFAULT_KONTAKT_FIRST_NAME_Y, 1, 5
Sleep 300
SendInput, ^a
SendInput, ^c
Sleep 50
SendInput, {esc}
Sleep 50
; Rename track to copied instrument name
SendInput, {Alt Down}
SendInput, {Ctrl Down}
SendInput, {Shift Down}
Sleep 50
SendInput, r
Sleep 50
SendInput, {Alt Up}
SendInput, {Ctrl Up}
SendInput, {Shift Up}
Sleep 200
SendInput, ^v
SendInput, {enter}
See, looks quite easy...it's mostly for one time only usage because you want your windows to be at the same position at all times etc...unless of course you want it to be reusable - then you will have to invest a bit more time
P.S.
Don't forget to use "Active Window Info (Windows Spy)" that comes installed with AHK. You can easily see which coordinates to use for MouseClick commands with it...
Last edited by Breeder; 04-04-2019 at 06:38 AM.
|
|
|
04-04-2019, 11:44 AM
|
#357
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Cool, that's really a game-changer, thanks!!!
I'll definitely look into it....
|
|
|
04-04-2019, 02:52 PM
|
#358
|
Human being with feelings
Join Date: Dec 2015
Posts: 172
|
Hi, Julian! And all guys)
Can you make possible to play Wav sounds right from LUA? Read file from file path,and then play without need to import into project or RS5k?
Xenakios said here https://forum.cockos.com/showthread.php?t=219316
that it's possible to do! This function is super needed!
|
|
|
04-04-2019, 03:59 PM
|
#359
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by kartalex
Hi, Julian! And all guys)
Can you make possible to play Wav sounds right from LUA? Read file from file path,and then play without need to import into project or RS5k?
Xenakios said here https://forum.cockos.com/showthread.php?t=219316
that it's possible to do! This function is super needed!
|
Playback is certainly possible and I already got it working in my fork of the js_ReaScriptAPI extension plugin. However, there are some difficulties cleaning up things properly once the file has played to the end, so I am not going to make a pull request into the main repository at this point.
If/when it can be made to work properly, the script code should be very simple :
Code:
local src = reaper.PCM_Source_CreateFromFile("C:\\MusicAudio\\cat.wav")
reaper.Xen_StartSourcePreview(src, 0.9, false)
-- 0.9 is the playback gain, false is for loop/no-loop
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
04-04-2019, 08:55 PM
|
#360
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Yikes, this is a whole other programming language!
Let's see, so far I've learned LUA, JSFX, and WALTER.
Now I get to add AHK, just in case my brainpower wasn't 100% taxed already.
Well, maybe I'll look into it when I'm a little further along in LUA. Right now, it doesn't look like a net gain over a crapload of mousing, not at the rate I learn new languages....
Thanks anyway
|
|
|
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 10:41 PM.
|