|
|
|
06-22-2020, 04:11 PM
|
#1281
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
How does SWS do it? They have arm-builds as well.
|
|
|
06-27-2020, 12:46 PM
|
#1282
|
Human being with feelings
Join Date: Apr 2014
Posts: 398
|
Hey folks!
I try to use the JS_VKeys_GetState function in eel.
In lua, it works well with these lines:
function main()
if reaper.JS_VKeys_GetState(0):byte(0x0D) ~= 0 then -- Return Key
Print("hello")
end
reaper.defer(main)
end
main()
But in eel I can't find what is the equivalent of the string.byte function.
Any help will be greatly appreciated! :-)
|
|
|
06-30-2020, 05:47 PM
|
#1283
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
JS_Mouse_SetPosition seems not to work on macOS. It does not move the mouse cursor
|
|
|
07-03-2020, 01:32 PM
|
#1284
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by amagalma
JS_Mouse_SetPosition seems not to work on macOS. It does not move the mouse cursor
|
I hope this isn't another OSX swell or Metal bug. Which OS version are you using? It works fine on my High Sierra.
Are you running the function inside a deferred loop or perhaps and while loop? What happens when you run a single-line script with only JS_Mouse_Setposition?
|
|
|
07-03-2020, 01:43 PM
|
#1285
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Infrabass
But in eel I can't find what is the equivalent of the string.byte function.
Any help will be greatly appreciated! :-)
|
I'm not familiar with EEL, but since no-one else has answered, I looked through the EEL API and found str_getchar:
https://www.extremraym.com/cloud/rea...el_str_getchar
|
|
|
07-03-2020, 01:44 PM
|
#1286
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by juliansader
I hope this isn't another OSX swell or Metal bug. Which OS version are you using? It works fine on my High Sierra.
Are you running the function inside a deferred loop or perhaps and while loop? What happens when you run a single-line script with only JS_Mouse_Setposition?
|
Catalina, but on VMWare... Just a single line script: reaper.JS_Mouse_SetPosition( 100, 100 )
|
|
|
07-04-2020, 05:02 PM
|
#1287
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by amagalma
Catalina, but on VMWare... Just a single line script: reaper.JS_Mouse_SetPosition( 100, 100 )
|
If anyone else that uses macOS is reading this, I would appreciate it if you could try that single-line script, to check if the problem can be reproduced on other systems.
|
|
|
07-10-2020, 06:25 AM
|
#1289
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I have a question about intercepting keyboard-messages.
I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.
Now here's my problem: how can I do that?
Code:
gfx.init()
function main()
Key=gfx.getchar()
if Key~=-1 and Key~=13 and Key~=27 and Key~=32 then
-- What do I need to write in this if-branch?
reaper.ClearConsole()
reaper.ShowConsoleMsg("This Key is sent to the Arrangeview")
else
reaper.ClearConsole()
reaper.ShowConsoleMsg("This Key is treated in gfx-window and not sent to Arrangeview")
end
reaper.defer(main)
end
main()
|
|
|
07-10-2020, 06:26 AM
|
#1290
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
How owuld one send an "ENTER" to a window? The hexadecimal value is 0x0D accroding to this site: https://docs.microsoft.com/en-us/win...tual-key-codes
I tried this:
Code:
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_KEYDOWN", 0x0D, 0, 0, 0)
But doesnt seem to work, even though the script saves & compiles ok in IDE.
|
|
|
07-10-2020, 06:35 AM
|
#1291
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by reapero
How owuld one send an "ENTER" to a window? The hexadecimal value is 0x0D accroding to this site: https://docs.microsoft.com/en-us/win...tual-key-codes
I tried this:
Code:
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_KEYDOWN", 0x0D, 0, 0, 0)
But doesnt seem to work, even though the script saves & compiles ok in IDE.
|
I tried using JS_WindowMessage_Post instead and the following code triggers a lot of actions through that:
Code:
hwnd=reaper.GetMainHwnd()
i=0
function main()
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", i,0,0,0)
i=i+1
reaper.ShowConsoleMsg("")
reaper.ShowConsoleMsg(i)
reaper.defer(main)
end
main()
Though I haven't found out, which one is for Enter, but maybe this helps you in a way...
Edit:
13 does the trick, which is the same as 0x0D
Edit2:
Hmm, only when used in a defer-cycle, but not if in a regular script. This is odd O_O
Edit3:
Its even weirder, sometimes it triggers after the third time sending the message, sometimes after the fourth, sometimes way above 20 times sending the message. And only in defer-loops, not in non deferred-scripts.
I can not make any sense of that.
This sometimes works, sometimes not...
Code:
hwnd=reaper.GetMainHwnd()
o=0
function main()
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)
if o<20 then reaper.defer(main) o=o+1 end
end
main()
Last edited by Meo-Ada Mespotine; 07-10-2020 at 06:48 AM.
|
|
|
07-10-2020, 06:39 AM
|
#1292
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by Meo-Ada Mespotine
I have a question about intercepting keyboard-messages.
I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.
Now here's my problem: how can I do that?
Code:
gfx.init()
function main()
Key=gfx.getchar()
if Key~=-1 and Key~=13 and Key~=27 and Key~=32 then
-- What do I need to write in this if-branch?
reaper.ClearConsole()
reaper.ShowConsoleMsg("This Key is sent to the Arrangeview")
else
reaper.ClearConsole()
reaper.ShowConsoleMsg("This Key is treated in gfx-window and not sent to Arrangeview")
end
reaper.defer(main)
end
main()
|
Not at the computer right now, but you would use https://www.extremraym.com/cloud/rea...VKeys_GetState to get the current key state and compare it with the desired values.
Edit, sorry, of course you also need to intercept the keys:
https://www.extremraym.com/cloud/rea...Keys_Intercept
|
|
|
07-10-2020, 06:50 AM
|
#1293
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by _Stevie_
|
The problem is, and it's close to reapero's problem as well, is not getting the keys, but sending them to the Reaper-window. This seems not to be that easy as I thought it could be...
|
|
|
07-10-2020, 06:59 AM
|
#1294
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
That’s pretty doable, though. You would basically only intercept the keys that you don’t want to be sent to the reaper window. The other keys will be passed thru.
|
|
|
07-10-2020, 07:02 AM
|
#1295
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
Quote:
Originally Posted by Meo-Ada Mespotine
Edit3:
Its even weirder, sometimes it triggers after the third time sending the message, sometimes after the fourth, sometimes way above 20 times sending the message. And only in defer-loops, not in non deferred-scripts.
I can not make any sense of that.
This sometimes works, sometimes not...
Code:
hwnd=reaper.GetMainHwnd()
o=0
function main()
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)
if o<20 then reaper.defer(main) o=o+1 end
end
main()
|
Confirmed..this actually triggered ENTER in the other window. Is this possibly an API bug then?
|
|
|
07-10-2020, 07:21 AM
|
#1296
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
In most cases you'll want to send an "up" message after sending a "down" message, otherwise it might screw up how the keyboard interacts with the app and/or OS. And if you launch a script from a keyboard shortcut it most likely will interfere with the key your trying to send.
I haven't done much key sending but trying to send a BackSpace key to the search field of Explorer I ended up having to POST (not Send) just the key up message for it to work as expected. So you need to experiment I guess for your target window.
Code:
local VK_BACK = 0x8 -- backspace key
local explorer = reaper.OpenMediaExplorer("", false)
if not explorer then --not-docked and closed
reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
explorer = reaper.OpenMediaExplorer("", false)
end
local search = reaper.JS_Window_FindChildByID(explorer, 1015)
if search then
if not reaper.JS_Window_IsVisible(search) then -- when docked but not visible
reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
end
-- send backspace key to Explorer search feild textbox
reaper.JS_WindowMessage_Post(search, "WM_KEYUP", VK_BACK, 0,0,0)
end
|
|
|
07-10-2020, 07:25 AM
|
#1297
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by Edgemeal
In most cases you'll want to send an "up" message after sending a "down" message, otherwise it might screw up how the keyboard interacts with the app and/or OS. And if you launch a script from a keyboard shortcut it most likely will interfere with the key your trying to send.
I haven't done much key sending but trying to send a BackSpace key to the search field of Explorer I ended up having to POST (not Send) just the key up message for it to work as expected. So you need to experiment I guess for your target window.
Code:
local VK_BACK = 0x8 -- backspace key
local explorer = reaper.OpenMediaExplorer("", false)
if not explorer then --not-docked and closed
reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
explorer = reaper.OpenMediaExplorer("", false)
end
local search = reaper.JS_Window_FindChildByID(explorer, 1015)
if search then
if not reaper.JS_Window_IsVisible(search) then -- when docked but not visible
reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
end
-- send backspace key to Explorer search feild textbox
reaper.JS_WindowMessage_Post(search, "WM_KEYUP", VK_BACK, 0,0,0)
end
|
I had experimented with WM_KEYDOWN as well, but it didn't change, at least on Windows.
I also tried WM_KEYFIRST and WM_KEYLAST but it didn't work either.
|
|
|
07-10-2020, 07:41 AM
|
#1298
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
Just tried with "WM_KEYUP" and doesnt seem to work either. It doesn´t work inside a defer loop, unlike WM_KEYDOWN.
Sending WM_KEYDOWN and then WM_KEYUP outside of the loop didnt work either.
|
|
|
07-10-2020, 08:33 AM
|
#1299
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
What window is it, is it something in REAPER we can all easily test? And if possible can you post the code you're using to get the window handle, send the key, etc.
|
|
|
07-10-2020, 09:08 AM
|
#1300
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
Sure. Its cmd. I am sending from a lua script within Reaper to a python script (triggered by a .bat if that matters).
Code:
hwnd = reaper.JS_Window_Find("cmd", false)
--ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN",0x0D, 0, 0, 0)
--ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYUP",0x0D, 0, 0, 0)
o=0
function main()
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)
if o<20 then reaper.defer(main) o=o+1 end
end
main()
I commented what didnt work and left Mespotine´s loop there..although this causes some other troubles.
|
|
|
07-10-2020, 10:18 AM
|
#1301
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
No experience with python, but one thing to try is to set focus on the window before sending the messages to it. Good Luck!
|
|
|
07-10-2020, 12:52 PM
|
#1302
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by _Stevie_
However, I have an issue with the Draw Ramp tool in OSX (Script: js_Mouse editing - Draw ramp.lua), as seen in this GIF.
The mouse cursor jumps from top to bottom very quickly:
|
Please check if this has been fixed in the recent update.
|
|
|
07-10-2020, 12:55 PM
|
#1303
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Meo-Ada Mespotine
I have a question about intercepting keyboard-messages.
I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.
|
Some time ago, another user had the same issue, and my suggested solution is in this this thread: Script Requests for a reasonable $$$.
I am not sure how REAPER's keyboard input is handled "under the hood". Unlike mouse inputs, which are directed to specific windows, can be simulated with WindowMessage_Post/Send, and can be intercepted by WindowMessage_Intercept, REAPER's keyboard inputs seem to enter a global queue, and some key presses (particularly shortcuts, IIRC), do not seem to be handled via window messages.
|
|
|
07-10-2020, 02:00 PM
|
#1304
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,185
|
Does anyone know if there's a way of getting the mouse coordinates of the edit cursor on the arrange page? (mac-friendly coordinates)
Cheers
|
|
|
07-10-2020, 03:00 PM
|
#1305
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Triode
Does anyone know if there's a way of getting the mouse coordinates of the edit cursor on the arrange page? (mac-friendly coordinates)
Cheers
|
I'm not sure what you mean by "mouse coordinates of the edit cursor"?
To get the x coordinate of the edit cursor:
Code:
editCursorTime = reaper.GetCursorPosition()
arrangeStartTime = reaper.GetSet_ArrangeView2(0, false, 0, 0)
pixelsPerSecond = reaper.GetHZoomLevel()
editCursorXCoordinate = (editCursorTime-arrangeStartTime)*pixelsPerSecond
|
|
|
07-10-2020, 03:18 PM
|
#1306
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,185
|
Lovely thank you I'll give that a try
|
|
|
07-11-2020, 04:13 AM
|
#1307
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by juliansader
Please check if this has been fixed in the recent update.
|
Fixed, thanks man! Fun fact: I seem the only one to test these features on OSX, eventhough OSX is not even my main platform
|
|
|
07-11-2020, 11:27 AM
|
#1308
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
Quote:
Originally Posted by juliansader
Some time ago, another user had the same issue, and my suggested solution is in this this thread: Script Requests for a reasonable $$$.
I am not sure how REAPER's keyboard input is handled "under the hood". Unlike mouse inputs, which are directed to specific windows, can be simulated with WindowMessage_Post/Send, and can be intercepted by WindowMessage_Intercept, REAPER's keyboard inputs seem to enter a global queue, and some key presses (particularly shortcuts, IIRC), do not seem to be handled via window messages.
|
Hey Julian. Forgive my ingorance but for the case i mention above, which is not trying to intercept messages and redirect them, but just to send an ENTER message from the script , the above wouldnt apply no?
Following your script on that message you mentioned and Edgemeal advice, i´ve tried to set the focus before sending the message, but it still didnt work.
Then i´ve tried sending simple messages and looks like "WM_KEYDOWN" wont even send an "a" to cmd, however "WM_CHAR" seems to send it correctly. I cant send ENTER messages with "WM_CHAR", can i?
Here´s the code:
Code:
hwnd = reaper.JS_Window_Find("cmd", false)
reaper.JS_Window_SetFocus(hwnd)
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_CHAR", string.byte("a"), 0, 0, 0)
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN",0x41, 0, 0, 0)
|
|
|
07-26-2020, 10:45 AM
|
#1309
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
|
soo, what function create this boxes that one can see for exemple in JS script ( Multi Tool)
|
|
|
07-27-2020, 01:21 PM
|
#1310
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by daniellumertz
soo, what function create this boxes that one can see for exemple in JS script ( Multi Tool)
|
Create a LICE bitmap, composite the bitmap onto a REAPER window, and then draw rectangles or anything else in the LICE bitmap.
In the Multi Tool, I only use one large bitmap, with multiple graphical elements inside the bitmap. Sexan's Area51 script used multiple bitmaps, one for each graphical element / area.
|
|
|
07-29-2020, 08:53 AM
|
#1311
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub), and suggested you should decide on one, so you are legally on the safe side.
Otherwise someone could sue you, if they grow a third pair of shoes instead of their noses while using your extension
We use MIT-license, which is quite nice for stuff like that, I think ReaPack uses LGPL or something(dunno what SWS uses).
|
|
|
07-31-2020, 07:08 PM
|
#1312
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by mespotine
@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub), and suggested you should decide on one, so you are legally on the safe side.
Otherwise someone could sue you, if they grow a third pair of shoes instead of their noses while using your extension
We use MIT-license, which is quite nice for stuff like that, I think ReaPack uses LGPL or something(dunno what SWS uses).
|
When you don't chose a licence, it means it's "all rights reserved."
Copyright is granted automatically by the law the moment something is created so nobody can sue him unless he himself used something against the copyright which belongs to someone else. He is the sole owner of his work and him picking a licence is not really mandatory. And licence is just an example anyway (albeit a real one if you chose to use it), you can write your own terms etc...
|
|
|
07-31-2020, 07:13 PM
|
#1313
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I didn't mean any copyright-issues, but more the "Use it at your own risk"-feature a license has. Like this snippet of the MIT-license:
Quote:
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
07-31-2020, 07:16 PM
|
#1314
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by Meo-Ada Mespotine
I didn't mean any copyright-issues, but more the "Use it at your own risk"-feature a license has. Like this snippet of the MIT-license:
|
That's a good point!
|
|
|
08-02-2020, 05:27 PM
|
#1315
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by mespotine
@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub),
|
I am not familiar with the legalities of open source, relatively informal code such as extensions and scripts, but it is not something I would lose sleep over.
If I do add a disclaimer, I'm not sure where it should go? Somewhere in the source code perhaps? Extensions and scripts that are installed via ReaPack do not pop up dialog windows that ask the user to accept T&Cs, and very few users ever look at the source code, particularly of C++ scripts.
I may be totally mistaken, but I don't think that a disclaimer or license that is hidden from the user would carry any legal weight.
The best would probably be if REAPER's own T&Cs include a reference to scripts and extensions, or otherwise ReaPack's.
|
|
|
08-02-2020, 06:11 PM
|
#1316
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I think a license.md in the gitrepo and stating it's licensed under a specific license in the ReaPack-description itself would be enough imho.
Though, I add a license into any sourcecodefile I have as well, just in case.
So users recycling my code know, under which conditions it's allowed, giving them more safety in these areas too.
|
|
|
08-23-2020, 07:52 AM
|
#1317
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Issue Getting Selected Regions
Hey there! Currently running into an issue where users of one of my scripts are reporting a problem processing selected regions in the region/marker manager. It works perfectly as intended on Windows 10, and both users that have reported issues are on Mac. It's just not processing selected regions at all, so presumably the issue is rooted in finding the Region/Marker Manager window on Mac. Beyond that, all of them are on the latest version. Copying the code snippets below, adapted from X-Raym's ReaScript template. Any help would be greatly appreciated!
https://github.com/ReaTeam/ReaScript...%20manager.lua
Code:
function getSelectedRegions()
local hWnd = getRegionManager()
if hWnd == nil then return end
local container = reaper.JS_Window_FindChildByID(hWnd, 1071)
sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(container)
if sel_count == 0 then return end
names = {}
i = 0
for index in string.gmatch(sel_indexes, '[^,]+') do
i = i+1
local sel_item = reaper.JS_ListView_GetItemText(container, tonumber(index), 1)
if sel_item:find("R") ~= nil then
names[i] = tonumber(sel_item:sub(2))
end
end
-- Return table of selected regions
return names
end
function getRegionManager()
local title = reaper.JS_Localize("Region/Marker Manager", "common")
local arr = reaper.new_array({}, 1024)
reaper.JS_Window_ArrayFind(title, true, arr)
local adr = arr.table()
for j = 1, #adr do
local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
-- verify window by checking if it also has a specific child.
if reaper.JS_Window_FindChildByID(hwnd, 1056) then -- 1045:ID of clear button
return hwnd
end
end
end
|
|
|
08-23-2020, 10:28 AM
|
#1318
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by acendan
Hey there! Currently running into an issue where users of one of my scripts are reporting a problem processing selected regions in the region/marker manager. It works perfectly as intended on Windows 10, and both users that have reported issues are on Mac. It's just not processing selected regions at all, so presumably the issue is rooted in finding the Region/Marker Manager window on Mac. Beyond that, all of them are on the latest version. Copying the code snippets below, adapted from X-Raym's ReaScript template. Any help would be greatly appreciated!
https://github.com/ReaTeam/ReaScript...%20manager.lua
Code:
function getSelectedRegions()
local hWnd = getRegionManager()
if hWnd == nil then return end
local container = reaper.JS_Window_FindChildByID(hWnd, 1071)
sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(container)
if sel_count == 0 then return end
names = {}
i = 0
for index in string.gmatch(sel_indexes, '[^,]+') do
i = i+1
local sel_item = reaper.JS_ListView_GetItemText(container, tonumber(index), 1)
if sel_item:find("R") ~= nil then
names[i] = tonumber(sel_item:sub(2))
end
end
-- Return table of selected regions
return names
end
function getRegionManager()
local title = reaper.JS_Localize("Region/Marker Manager", "common")
local arr = reaper.new_array({}, 1024)
reaper.JS_Window_ArrayFind(title, true, arr)
local adr = arr.table()
for j = 1, #adr do
local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
-- verify window by checking if it also has a specific child.
if reaper.JS_Window_FindChildByID(hwnd, 1056) then -- 1045:ID of clear button
return hwnd
end
end
end
|
What is the actual error-message the users got when running this script on Mac?
|
|
|
08-23-2020, 10:43 AM
|
#1319
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Quote:
Originally Posted by Meo-Ada Mespotine
What is the actual error-message the users got when running this script on Mac?
|
Not reporting any error at all, it's just not doing anything. Which leads me to believe the source of the issue is:
Code:
if hWnd == nil then return end
If I had a mac I'd test it myself. Might be able to get my hands on one within the next day or two. Mostly just probing to see if this is a known problem. Thanks for the help, btw!
|
|
|
08-23-2020, 10:50 AM
|
#1320
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Could you change all lines ending with
to
Code:
then reaper.ShowConsoleMsg("insert useful message in here") return end
and let the user try the script again?
For instance, the line
Code:
if hWnd == nil then return end
could read
Code:
if hWnd == nil then reaper.ShowConsoleMsg("No hwnd found, sorry.") return end
That way we can see, where the script exits at the user and therfore come closer to the actual problem.
Make all shown messages be different.
|
|
|
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 04:20 AM.
|