|
|
|
08-24-2020, 11:28 AM
|
#1321
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Issue Getting Selected Regions
Quote:
Originally Posted by Meo-Ada Mespotine
Could you change all lines ending with ...
That way we can see, where the script exits at the user and therfore come closer to the actual problem.
|
Again, thanks for the help. I did that and passed the updated function along to the user, seen below.
Code:
function getSelectedRegions()
local hWnd = getRegionManager()
if hWnd == nil then reaper.MB("Failed to get region/marker manager window. Make sure you have the window open: View > Region/Marker Manager.","ERROR #1", 0) return end
local container = reaper.JS_Window_FindChildByID(hWnd, 1071)
sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(container)
if sel_count == 0 then reaper.MB("Nothing selected in the region/marker manager!","ERROR #2", 0) return end
local rgn_selected_bool = false
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))
rgn_selected_bool = true
end
end
if not rgn_selected_bool then reaper.MB("No regions selected in the region/marker manager!","ERROR #3", 0) return end
-- Return table of selected regions
return names
end
They received ERROR #3, which leads me to believe it might just be a user error problem (potentially not having the regions checkbox enabled in the region marker manager). I'm going to try and video chat with them, if possible, but in the mean time, figured I'd provide an update. Thanks again!
|
|
|
08-24-2020, 02:16 PM
|
#1322
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Looks like it wasn't user error, it's just not getting the selected regions; see photo below. Again, no issue with this exact same setup on Windows 10, just on Mac. Thanks!
|
|
|
08-24-2020, 06:42 PM
|
#1323
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Ok, can you post the entire script in here, so I can give it a check?
|
|
|
08-24-2020, 07:05 PM
|
#1324
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Quote:
Originally Posted by Meo-Ada Mespotine
Ok, can you post the entire script in here, so I can give it a check?
|
Sure! It's part of a web interface, though, so the script itself doesn't really do much by itself (hence why I only picked out that part).
https://raw.githubusercontent.com/ac...ing%20Tool.lua
The web interface is included in my full github, linked here:
https://github.com/acendan/reascripts
|
|
|
08-29-2020, 06:12 PM
|
#1325
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by acendan
They received ERROR #3, which leads me to believe it might just be a user error problem (potentially not having the regions checkbox enabled in the region marker manager). I'm going to try and video chat with them, if possible, but in the mean time, figured I'd provide an update. Thanks again!
|
I can confirm that, on MacOS, the listview functions unfortunately do not return the text of sub-items from windows that have spreadsheet-like "blocks", such as the Region/Marker Manager or the Track Manager. The functions do work on listviews such as FX Browser and Actions list.
I will submit a bug report.
|
|
|
08-30-2020, 09:47 AM
|
#1326
|
Human being with feelings
Join Date: Jun 2020
Location: Florida, US
Posts: 41
|
Quote:
Originally Posted by juliansader
I can confirm that, on MacOS, the listview functions unfortunately do not return the text of sub-items from windows that have spreadsheet-like "blocks", such as the Region/Marker Manager or the Track Manager. The functions do work on listviews such as FX Browser and Actions list.
I will submit a bug report.
|
Ah, unfortunate to hear but thanks for the update and for submitting the bug report!
|
|
|
09-05-2020, 01:48 AM
|
#1327
|
Human being with feelings
Join Date: Jul 2019
Posts: 43
|
Hello!
I have a small question regarding the js_reascript API. Is it possible to intercept the windows key? I succeeded in triggering some actions based on the key state, but as it always launches the win10 menu it is not really usable.
Thanks!
|
|
|
09-05-2020, 07:22 AM
|
#1328
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
IIRC, the windows key is a combination of ctrl+esc, so you probably need to check for that.
JS_Mouse_GetState will help you getting the ctrl-key.
Last edited by Meo-Ada Mespotine; 09-05-2020 at 02:28 PM.
|
|
|
09-08-2020, 07:55 AM
|
#1329
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by JLP
Hello!
I have a small question regarding the js_reascript API. Is it possible to intercept the windows key? I succeeded in triggering some actions based on the key state, but as it always launches the win10 menu it is not really usable.
Thanks!
|
The virtual key codes for the Win keys are:
VK_LWIN Left Windows key (Natural keyboard)
0x5B
VK_RWIN Right Windows key (Natural keyboard)
0x5C
Using these codes, you can check the state of the Win key (you can also use JS_Mouse_GetState), but unfortunately, unlike normal keys such as "A", you cannot *block* control keys such as Win or Ctrl. (On Windows, at least -- I'm not sure about macOS.)
|
|
|
09-09-2020, 09:09 AM
|
#1330
|
Human being with feelings
Join Date: Jul 2019
Posts: 43
|
That's what I was suspected... Thank you, Juliansader and Mespotine for your help
|
|
|
09-13-2020, 01:42 PM
|
#1331
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
I wonder if it would be possible to merge into JSReascriptAPI the file functions found here https://forum.cockos.com/showthread.php?t=225701
I would ask there in that thread but I find that snooks is banned? No idea.
JSReascriptAPI could rescue us suffering in the other thread https://forum.cockos.com/showthread.php?t=220937 about finding a good way to get the creation date or modified date of a file in Lua.
or maybe it could be added to SWS too? I don't know.
|
|
|
09-13-2020, 05:35 PM
|
#1332
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
+1 from me. Would be a huge help.
|
|
|
09-14-2020, 07:35 AM
|
#1333
|
Human being with feelings
Join Date: Sep 2016
Posts: 513
|
Hi, I can't install the extension in my new reaper installation. I put the plugin in userplugin but I can't find any additional script in my "midi injecor or other" list. Can you help me please?
Are there any dependencies to install that I could forget?
Last edited by grandfougue; 09-14-2020 at 08:09 AM.
|
|
|
09-14-2020, 11:16 AM
|
#1334
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
It doesn't add new actions to the list. It gives new functions for us scripters so we can write new awesome scripts.
So if you don't see something new in the actionlist, this is expected.
But if you see an error message when running a script which requires it, then there's a problem.
|
|
|
09-18-2020, 05:01 AM
|
#1335
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Juliansader
Hi !
Do you think it is possible to get/set audio file section timecode form media explorer waeform preview ?
Like for example, an action to shift current section by a it's length duration ?
Thx !
|
|
|
09-23-2020, 03:01 AM
|
#1336
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
So we can iterates in selected objects of a LIST,
but can we Select items from this list based on a number ?
I don't find the related function.
|
|
|
09-26-2020, 04:38 AM
|
#1337
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by X-Raym
Do you think it is possible to get/set audio file section timecode form media explorer waeform preview ?
Like for example, an action to shift current section by a it's length duration ?
|
Do you know if there are C++ functions to achieve this?
|
|
|
09-30-2020, 04:39 AM
|
#1338
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
What is the string to bring back to normal state a maximized window?
Code:
reaper.JS_Window_SetStyle( script_hwnd, "MAXIMIZE" )
EDIT:
I tried "RESTORE", "SHOWNORMAL" but didn't work..
These seem to work:
Code:
reaper.JS_Window_Show( script_hwnd, "SHOWDEFAULT" )
or "RESTORE" or "SHOWNORMAL"
EDIT2:
But the window title bar is missing... How do I bring it back?
This seems to bring back the title bar:
Code:
reaper.JS_Window_SetStyle( script_hwnd, "CAPTION" )
EDIT3:
But the window is no more resizable! How can I make it resizable again?
This seems to bring it back as it was:
Code:
reaper.JS_Window_Show( script_hwnd, "RESTORE" )
reaper.JS_Window_SetStyle( script_hwnd, "THICKFRAME|CAPTION|SYSMENU" )
When I started the script, the window had these styles: CAPTION, POPUP, VISIBLE, CLIPSIBLINGS, SYSMENU and THICKFRAME.
After maximizing it and restoring it with the code above it has the same as above but POPUP is missing and OVERLAPPED has been added. Would that pose any problem? (it seems to work as in the beginning)
EDIT4: Yes, it creates a problem: JS_Window_AttachTopmostPin does not work any more. Any ideas?
Is there any workaround to achieve maximized state in MacOS and Linux, since "MAXIMIZE" is not implemented?
Thanks!
Last edited by amagalma; 09-30-2020 at 06:25 AM.
|
|
|
09-30-2020, 07:21 AM
|
#1339
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Not sure it helps, just another way to max & restore, etc,..
https://docs.microsoft.com/en-us/win.../wm-syscommand
This works fine on gfx window. (Win10 x64)
Code:
-- Maximize,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF030, 0, 0, 0)
-- Restore,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF120, 0, 0, 0)
EDIT:
Using JS_Window_SetStyle to change the show state of a window seems kind of odd, normally you'd use ShowWindow() to do that, or send a WM_SYSCOMMAND msg.
Last edited by Edgemeal; 09-30-2020 at 03:54 PM.
|
|
|
09-30-2020, 10:07 PM
|
#1340
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Edgemeal
Not sure it helps, just another way to max & restore, etc,..
https://docs.microsoft.com/en-us/win.../wm-syscommand
This works fine on gfx window. (Win10 x64)
Code:
-- Maximize,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF030, 0, 0, 0)
-- Restore,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF120, 0, 0, 0)
EDIT:
Using JS_Window_SetStyle to change the show state of a window seems kind of odd, normally you'd use ShowWindow() to do that, or send a WM_SYSCOMMAND msg.
|
Thanks Edgemeal!
This works fine, although it keeps the window title bar (I was actually trying to FullScreen, not Maximize):
Code:
-- Maximize,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF030, 0, 0, 0)
This does not work here:
Code:
-- Restore,
reaper.JS_WindowMessage_Send(hwnd, "WM_SYSCOMMAND", 0xF120, 0, 0, 0)
-- but this works:
Code:
reaper.JS_Window_Show( script_hwnd, "RESTORE" )
|
|
|
10-01-2020, 06:23 AM
|
#1341
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by amagalma
This works fine, although it keeps the window title bar (I was actually trying to FullScreen, not Maximize):
|
Oh OK, I got confused by the word "MAXIMIZE", I suppose there should also be a "RESTORE" option for SetStyle as well then.
IIRC, I used SetStyle to remove the window borders, then use ShowWindow to maximize, the window was then full screen.
|
|
|
10-01-2020, 06:44 AM
|
#1342
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@juliansader,
Absolutely no idea on the C++ side of my two questions :S
|
|
|
10-01-2020, 03:06 PM
|
#1343
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by X-Raym
So we can iterates in selected objects of a LIST,
but can we Select items from this list based on a number ?
I don't find the related function.
|
No, not for selecting ListView items.
Last edited by Edgemeal; 10-02-2020 at 04:49 AM.
Reason: REMOVE SOLUTION, WAIT ON JULIAN API
|
|
|
10-01-2020, 04:09 PM
|
#1344
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by X-Raym
So we can iterates in selected objects of a LIST,
but can we Select items from this list based on a number ?
|
Do you mean that you want to set an item's state to "selected", so that it is visually highlighted inside the listview window?
I can add ListView_SetItemState to the next update.
|
|
|
10-01-2020, 04:47 PM
|
#1345
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Quote:
Originally Posted by juliansader
I can add ListView_SetItemState to the next update.
|
This would be nice ! thx !
@edgemeal
Thanks for you try ! I guess using JS implementation will be simpler though :P
|
|
|
10-01-2020, 04:59 PM
|
#1346
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by juliansader
I can add ListView_SetItemState to the next update.
|
+1
Be sure to include a way to select & unselect.
Code:
(hwnd, -1, true) -- select all
(hwnd, -1, false) -- unselect all
(hwnd, index_array, true) -- select index
(hwnd, index_array, false) -- unselect index
|
|
|
10-01-2020, 06:35 PM
|
#1347
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
@JulianSader
Btw, did you manage the zip-file-management somehow, that you were planning?
|
|
|
10-03-2020, 04:14 PM
|
#1348
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I gave up in frustration a few months ago, because of problems with unicode filenames.
But good news! I gave it another go this weekend, and I finally managed to add unicode filenames to a zip archive.
I had to look into the innards of the OSS C++ library and make some modifications, but so far zipping seems to work fine. Tomorrow I will try unzipping.
|
|
|
10-06-2020, 11:04 PM
|
#1349
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
can anyone point me a way to know ID for using with: reaper.JS_Window_FindChildByID(hWnd, ChildId) on MAC?
Particularly i am looking for a way to open Instrument tab in fxchain for selected track or for a specific track GUID , and fill the search with some value, but i have no clue how to find this Id's on MAc!
Any help Appreciated!
Thank you
__________________
🙏🏻
|
|
|
10-07-2020, 08:39 AM
|
#1350
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Hold your mouse over the target window (the child window), and run this script:
Code:
w = reaper.JS_Window_FromPoint(reaper.GetMousePosition())
ID = reaper.JS_Window_GetLong(w, "ID")
|
|
|
10-07-2020, 08:40 AM
|
#1351
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.
|
|
|
10-07-2020, 10:05 AM
|
#1352
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by juliansader
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.
|
Does JS_File_Stat allow getting file-attributes?
Quote:
I gave up in frustration a few months ago, because of problems with unicode filenames.
But good news! I gave it another go this weekend, and I finally managed to add unicode filenames to a zip archive.
I had to look into the innards of the OSS C++ library and make some modifications, but so far zipping seems to work fine. Tomorrow I will try unzipping.
|
Great that you still try to make it work. I very much appreciate that
|
|
|
10-07-2020, 11:34 AM
|
#1353
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Meo-Ada Mespotine
Does JS_File_Stat allow getting file-attributes?
|
It returns all the attributes that the stat function gets: Modified/Accessed dates, size, owner, device, mode. Creation/Changed/Copied date too, if implemented by the OS.
|
|
|
10-07-2020, 11:40 AM
|
#1354
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Awesome! This allows a lot of script-optimizing when dealing with changed files!
|
|
|
10-08-2020, 03:04 AM
|
#1355
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
Quote:
Originally Posted by juliansader
Hold your mouse over the target window (the child window), and run this script:
Code:
w = reaper.JS_Window_FromPoint(reaper.GetMousePosition())
ID = reaper.JS_Window_GetLong(w, "ID")
|
Thank you so so so much ! it's a starting point for me! but still I have another question:
I open fxchain and i need to simulate a left click on add button which appears in bottom left of fxchain.
i use something like:
-- get one opened Fxchain
w = reaper.JS_Window_Find("FX: Track 3", true)
-- get Id of add button
addButton = reaper.JS_Window_FindChildByID(w, 1075)
How can i simulate a left click in this addButton?
__________________
🙏🏻
|
|
|
10-08-2020, 11:17 PM
|
#1356
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Code:
reaper.JS_WindowMessage_Send(addButton, "WM_LBUTTONDOWN", 1, 0, 10, 10)
reaper.JS_WindowMessage_Send(addButton, "WM_LBUTTONUP", 0, 0, 10, 10)
|
|
|
10-11-2020, 11:49 AM
|
#1357
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by juliansader
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.
|
thank you! I'm going to try it ASAP
|
|
|
10-12-2020, 01:01 PM
|
#1358
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by juliansader
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.
|
Thank you julian!
Would it be too difficult to add a File_Copy and a File_Move?
|
|
|
10-12-2020, 04:00 PM
|
#1359
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by amagalma
Thank you julian!
Would it be too difficult to add a File_Copy and a File_Move?
|
File move can be done with os.rename in Lua.
File copy, well, use my background copy feature, which doesn't block Reaper's UI (unlike probably a FileMove-function):
https://mespotin.uber.space/Ultrasch...ground_Copying
Edit:
MoveFileOrFolder-function in Ultraschall-Api.
https://mespotin.uber.space/Ultrasch...veFileOrFolder
Last edited by Meo-Ada Mespotine; 10-12-2020 at 04:12 PM.
|
|
|
10-12-2020, 05:53 PM
|
#1360
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by juliansader
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.
|
Cool!
Last edited by Edgemeal; 12-09-2021 at 02:46 PM.
|
|
|
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 06:47 PM.
|