Old 10-13-2020, 06:20 AM   #1361
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
I have uploaded v1.217 with new ListView functions as well as the requested JS_File_Stat function.

And I have updated my script doc with that.
X-Raym is offline   Reply With Quote
Old 10-28-2020, 11:22 AM   #1362
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Is it possible to use reaper.JS_ListView_SetItemText to change the custom tag in Media Explorer?

I try these code:
Code:
local title = reaper.JS_Localize("Media Explorer","common")
local hWnd = reaper.JS_Window_Find(title, true)
local container = reaper.JS_Window_FindChildByID(hWnd     , 0   )
local file_LV   = reaper.JS_Window_FindChildByID(container, 1000)
reaper.JS_ListView_SetItemText(file_LV, 0, 13, 'hello')
to set the first item's custom tag to 'hello'. But it failed. Nothing happened.
dsyrock is online now   Reply With Quote
Old 10-28-2020, 03:01 PM   #1363
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by dsyrock View Post
Is it possible to use reaper.JS_ListView_SetItemText to change the custom tag in Media Explorer?
When you edit column data in that LV what happens is an edit control is made visible (see change in gif) so you can then type/edit the text. A LV is generally used to only display data, not store it, so even when you can change the text (try the Actions list) its most likely only changing the text you see, and not going to change any actual data that REAPER uses internally.



Overall not impossible to solve, just not as simple as using that function.
Edgemeal is offline   Reply With Quote
Old 10-29-2020, 06:39 AM   #1364
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Edgemeal View Post
Overall not impossible to solve, just not as simple as using that function.
Thanks. I'm looking for a convineon way to edit the custom tag without editing the ReaperFileList file.
dsyrock is online now   Reply With Quote
Old 10-30-2020, 10:00 AM   #1365
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

I asked this question a while back, and don't know if it was ever fully answered:

Is it possible to save vst state as a preset via script? The conclusion seemed to be that when the dialog to select the name pops up, it would stop the script from running. I'd like to save with the existing name, so I could do without the popup. Including a possible new name in the script arguments would be ideal. But there doesn't seem to be anything in the API, and I guess if the window doesn't have a menu item, JS isn't much help?

But thought I'd ask anyway....
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 10-30-2020, 10:55 AM   #1366
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by woodslanding View Post
Is it possible to save vst state as a preset via script?
Only public script I know of is one by eugen2777, I never tried it tho.
https://forum.cockos.com/showpost.ph...66&postcount=1
Edgemeal is offline   Reply With Quote
Old 10-30-2020, 12:51 PM   #1367
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by dsyrock View Post
Thanks. I'm looking for a convineon way to edit the custom tag without editing the ReaperFileList file.
May not be possible with Julian's API, I think it may be missing a few Win32 API functions that I'd need to pull it off. Will think about it more.

Note, that code in post #1363 wasn't the best way to get the LV handle (not sure is we had FindChild back then?), and I just noticed the devs changed the control layout in Media Explorer in the latest pre-release, so that code most likely won't work in versions after v6.15.

Simplified test code to get handle of ListView in Media Explorer, for v6.15 and newer.
Code:
local hwnd = reaper.JS_Window_Find("Media Explorer", true)
local file_LV = reaper.JS_Window_FindChild(hwnd,"List1",true)
This is the problem with not having API functions from the developers, we have to hack our way around.

EDIT:
Devs also changed the search field from an edit control to a combo in the latest pre-release. Setting the text used to automatically search the media explorer, that no longer works, tried a few tricks and got no where. EDIT 2 Never mind I figured it out.

Last edited by Edgemeal; 10-30-2020 at 07:52 PM.
Edgemeal is offline   Reply With Quote
Old 10-30-2020, 07:49 PM   #1368
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by Edgemeal View Post
Only public script I know of is one by eugen2777, I never tried it tho.
https://forum.cockos.com/showpost.ph...66&postcount=1
Wow way more code than I expected.... but I'll try it and see if it works, thanks for tracking this down!

Since it seems to use the fx_chunk (which I was afraid wouldn't reflect recent edits) maybe some of Ultraschall's new fx chunk methods would work.... I'll look into that too.

cheers!
-eric
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 10-30-2020, 08:03 PM   #1369
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Edgemeal View Post
Simplified test code to get handle of ListView in Media Explorer, for v6.15 and newer.
Thanks for your advice. Actually, I don't really know what do those numbers (1000, 1001, 1002) mean. I just copy the code from Archie's script called: Copy selected files from media explorer to project subdirectory.lua, the only script I can find on reapack that teach me how to get information from Media Explorer.
dsyrock is online now   Reply With Quote
Old 10-30-2020, 08:51 PM   #1370
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by dsyrock View Post
Thanks for your advice. Actually, I don't really know what do those numbers (1000, 1001, 1002) mean. I just copy the code from Archie's script called: Copy selected files from media explorer to project subdirectory.lua, the only script I can find on reapack that teach me how to get information from Media Explorer.
The number used in the FindChildByID function (see GetDlgItem) is the control ID of the control we want to get the handle of, that ID number never changes unlike window handles. I often use a utility like SPY++ to get the ID#s.
https://forum.cockos.com/showpost.ph...&postcount=168
Edgemeal is offline   Reply With Quote
Old 10-30-2020, 11:25 PM   #1371
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Edgemeal View Post
The number used in the FindChildByID function (see GetDlgItem) is the control ID of the control we want to get the handle of, that ID number never changes unlike window handles. I often use a utility like SPY++ to get the ID#s.
https://forum.cockos.com/showpost.ph...&postcount=168
Wow the Control ID app is such an awesome app!

Last edited by dsyrock; 10-30-2020 at 11:38 PM.
dsyrock is online now   Reply With Quote
Old 10-31-2020, 07:18 AM   #1372
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Hey guys.
I'm trying to bring Reaper to foreground with MIDI.

I was trying to use:
Code:
reaper.JS_WindowMessage_Send(hwnd, 'WA_ACTIVATE',1,0,0,0)
function but I'm not really sure how to proceed. Anyone can help me?
lexaproductions is offline   Reply With Quote
Old 10-31-2020, 08:25 AM   #1373
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

As far as programming in Windows I've always used SetForegroundWindow to do that, try...

Code:
  hwnd = reaper.GetMainHwnd() -- get handle of REAPER main window
  reaper.JS_Window_SetForeground(hwnd)
Although I guess 'WM_ACTIVATE' might work too,?
Code:
hwnd = reaper.GetMainHwnd() -- get handle to REAPER main window
reaper.JS_WindowMessage_Send(hwnd, "WM_ACTIVATE",1,0,0,0)
Depending on what your end goal is, maybe read MSDN documentation!

Last edited by Edgemeal; 10-31-2020 at 08:38 AM.
Edgemeal is offline   Reply With Quote
Old 10-31-2020, 11:37 AM   #1374
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Quote:
Originally Posted by Edgemeal View Post
As far as programming in Windows I've always used SetForegroundWindow to do that, try...

Code:
  hwnd = reaper.GetMainHwnd() -- get handle of REAPER main window
  reaper.JS_Window_SetForeground(hwnd)
Although I guess 'WM_ACTIVATE' might work too,?
Code:
hwnd = reaper.GetMainHwnd() -- get handle to REAPER main window
reaper.JS_WindowMessage_Send(hwnd, "WM_ACTIVATE",1,0,0,0)
Depending on what your end goal is, maybe read MSDN documentation!
It may be because I'm on mac but for me:
Code:
reaper.JS_Window_SetForeground(
does not work reliably. It only does so when the Reaper is the foreground application. when it's in the background I'm not able to reliably bring it back using that function.

Code:
hwnd = reaper.GetMainHwnd() -- get handle to REAPER main window
reaper.JS_WindowMessage_Send(hwnd, "WM_ACTIVATE",1,0,0,0)
I was not able to obtain any response outside of the app using this. Might be a Mac thing?

Any mac user could confirm it's not only me?
lexaproductions is offline   Reply With Quote
Old 11-01-2020, 02:04 AM   #1375
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

I wrote a script that tries to click the 'process' button in the auto trim window automatically.

Code:
--part1
function auto_trim()
    local check=reaper.JS_Window_GetFocus()
    local parent=reaper.JS_Window_GetParent(check)
    if parent and reaper.JS_Window_GetTitle(parent)=='Auto trim/split items' then
        local btn=reaper.JS_Window_FindChild(parent,"Process",true)
        reaper.JS_WindowMessage_Send(btn, "WM_LBUTTONDOWN", 1, 0, 10, 10) 
        reaper.JS_WindowMessage_Send(btn, "WM_LBUTTONUP", 0, 0, 10, 10)
    else
        reaper.defer(auto_trim)
    end
end
auto_trim()

--part2
reaper.Main_OnCommand(40315, 0)  --auto trim
This script can't click the process button automatically unless I divide part1 and part2 into two independent scripts, and run them one by one, or join them in a custom action.

So I'm wondering why they can not stay in a script, is there any lua system issue here?
dsyrock is online now   Reply With Quote
Old 11-01-2020, 09:23 AM   #1376
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by dsyrock View Post
This script can't click the process button automatically unless I divide part1 and part2 into two independent scripts, and run them one by one, or join them in a custom action.
When you launch a modal window from a script using 'reaper.Main_OnCommand' it seems to wait for the window to close before the script can continue running again similar to how SendMessage works, so for cases like this try posting the action ID to the window, PostMessage returns immediately and doesn't wait for a return, this may not work in all cases but seems to be working OK for your script on Win10,..

Alternative way to code it,..
Code:
function auto_trim()
  local parent = reaper.JS_Window_FindTop('Auto trim/split items',true) 
  if parent then
    local btn = reaper.JS_Window_FindChild(parent,"Process",true)
    reaper.JS_WindowMessage_Send(btn, "WM_LBUTTONDOWN", 1, 0, 0, 0)
    reaper.JS_WindowMessage_Send(btn, "WM_LBUTTONUP", 0, 0, 0, 0)
  else
    reaper.defer(auto_trim)
  end
end

auto_trim()
reaper.JS_WindowMessage_Post(reaper.GetMainHwnd(), "WM_COMMAND", 40315,0,0,0)

Last edited by Edgemeal; 11-01-2020 at 10:21 AM.
Edgemeal is offline   Reply With Quote
Old 11-01-2020, 09:36 AM   #1377
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Edgemeal View Post
Code:
reaper.JS_WindowMessage_Post(reaper.GetMainHwnd(), "WM_COMMAND", 40315,0,0,0)
Perfectly worked! Thanks a lot!
dsyrock is online now   Reply With Quote
Old 11-03-2020, 08:21 AM   #1378
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

I've asked this before, but not in this subforum, so maybe one of you would know...

Is there any way of getting fullscreen out of a script? I'd love to lose the titlebar. True fullscreen would be great, but I'd be delighted with just a window the size of the screen (without a titlebar....)

THANKS!
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 11-03-2020, 08:30 AM   #1379
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Do you mean the Reaper-window itself? There's an action for that. Or do you mean fullscreen for windows like ie. gfx-windows?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-03-2020, 09:43 AM   #1380
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

Quote:
Originally Posted by woodslanding View Post
I've asked this before, but not in this subforum, so maybe one of you would know...

Is there any way of getting fullscreen out of a script? I'd love to lose the titlebar. True fullscreen would be great, but I'd be delighted with just a window the size of the screen (without a titlebar....)

THANKS!
Yes you can - assuming (as Meo-Ada asked) that you mean a script window - (using Julian's API) use something like:

Code:
local win = reaper.JS_Window_Find('<window title text>', true)
local style = reaper.JS_Window_GetLong(win, 'STYLE')
if style then
  style = style & (0xFFFFFFFF - 0x00C40000) --removes window frame
  reaper.JS_Window_SetLong(win, "STYLE", style)
end
Then you can make the window fullscreen using:

Code:
reaper.JS_Window_SetPosition(win, x, y, w, h)
where x y w h are the screen coordinates and dimensions
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website
lb0 is offline   Reply With Quote
Old 11-03-2020, 01:47 PM   #1381
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by woodslanding View Post
I've asked this before, but not in this subforum, so maybe one of you would know...

Is there any way of getting fullscreen out of a script? I'd love to lose the titlebar. True fullscreen would be great, but I'd be delighted with just a window the size of the screen (without a titlebar....)
I use this script to toggle my MIDI editor fullscreen and without titlebar from a toolbar button. You can simply replace "e" with whatever window you wish to make fullscreen:
Code:
e = reaper.JS_Window_FromPoint(reaper.GetMousePosition())
while (e and reaper.ValidatePtr(e, "HWND") and reaper.MIDIEditor_GetMode(e) == -1) do
    e = reaper.JS_Window_GetParent(e)
end
if e then
    is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
    s = reaper.GetToggleCommandStateEx(sectionID, cmdID)
    if s == 1 then
        reaper.JS_Window_SetStyle(e, "OVERLAPPEDWINDOW")
        reaper.SetToggleCommandState(sectionID, cmdID, 0)
    else
        reaper.JS_Window_SetStyle(e, "POPUP,MAXIMIZE")
        reaper.SetToggleCommandState(sectionID, cmdID, 1)
    end
    reaper.RefreshToolbar2(sectionID, cmdID)
end
juliansader is offline   Reply With Quote
Old 11-12-2020, 05:24 PM   #1382
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Do you mean the Reaper-window itself? There's an action for that. Or do you mean fullscreen for windows like ie. gfx-windows?
Well for the script itself... for the project I'm building in Scythe...
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 11-12-2020, 05:25 PM   #1383
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by lb0 View Post
Yes you can - assuming (as Meo-Ada asked) that you mean a script window - (using Julian's API) use something like:

Code:
local win = reaper.JS_Window_Find('<window title text>', true)
local style = reaper.JS_Window_GetLong(win, 'STYLE')
if style then
  style = style & (0xFFFFFFFF - 0x00C40000) --removes window frame
  reaper.JS_Window_SetLong(win, "STYLE", style)
end
Then you can make the window fullscreen using:

Code:
reaper.JS_Window_SetPosition(win, x, y, w, h)
where x y w h are the screen coordinates and dimensions
Most excellent, THANKS!!
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 11-14-2020, 04:22 AM   #1384
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Is there any way to get which is the current custom cursor?

Code:
JS_Mouse_GetCursor()
On Windows, retrieves a handle to the current mouse cursor.
On Linux and macOS, retrieves a handle to the last cursor set by REAPER or its extensions via SWELL.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-14-2020, 10:12 AM   #1385
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by amagalma View Post
Is there any way to get which is the current custom cursor?
Not sure if this helps, basically same way I did it for a Windows app, this detects if mouse cursor is the one for left edge of item in arrangeview here (Win10),..

Code:
prev_cursor = nil
BORDER_LEFT = reaper.JS_Mouse_LoadCursor(417) -- 417 (ordinal name: 250)
-- got cursor #'s via ResourceHacker.exe, http://www.angusj.com/resourcehacker/

function Main()
  local cur_cursor = reaper.JS_Mouse_GetCursor()
  if prev_cursor ~= cur_cursor then 
    prev_cursor = cur_cursor 
    if cur_cursor == BORDER_LEFT then 
      reaper.ShowConsoleMsg("BORDER_LEFT (#8) cursor detected!" .. '\n')
    end
  end 
  reaper.defer(Main)
end
 
Main()
reaper.defer(function () end)
Edgemeal is offline   Reply With Quote
Old 11-14-2020, 10:33 AM   #1386
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by Edgemeal View Post
Not sure if this helps, basically same way I did it for a Windows app, this detects if mouse cursor is the one for left edge of item in arrangeview here (Win10),..

Code:
prev_cursor = nil
BORDER_LEFT = reaper.JS_Mouse_LoadCursor(417) -- 417 (ordinal name: 250)
-- got cursor #'s via ResourceHacker.exe, http://www.angusj.com/resourcehacker/

function Main()
  local cur_cursor = reaper.JS_Mouse_GetCursor()
  if prev_cursor ~= cur_cursor then 
    prev_cursor = cur_cursor 
    if cur_cursor == BORDER_LEFT then 
      reaper.ShowConsoleMsg("BORDER_LEFT (#8) cursor detected!" .. '\n')
    end
  end 
  reaper.defer(Main)
end
 
Main()
reaper.defer(function () end)

Excellent! Thank you! I had thought to do it the same way as you did (by loading the cursor and comparing to current) but I didn't know which were and how to get the numbers. I downloaded Resource Hack and .. wow!.. Very useful! But again how did you get 417 out of 250 : 1033 (that is what is shown in ResourceHack)?

Edit. Found it! It's under the Cursor Group folder (32 × 32 (16 colors) - Ordinal name: 250)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 11-14-2020 at 10:41 AM.
amagalma is offline   Reply With Quote
Old 11-24-2020, 06:39 AM   #1387
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default Mouse click left down

Hi,


I have a problem with my change layout to last touched track script:
https://forum.cockos.com/showthread....31#post2365331


Thing is that I can move fader right after a track layout change, as if mouse events were reinitialized by track layout change.




See once activated how I cant move fader directly by click and drag ut have to click on the track first then reclick to move fader.



I was hoping to solve that with a mouse down click event but no success so far


Code:
h = reaper.JS_Window_HandleFromAddress( 1000 )
reaper.JS_WindowMessage_Send(      h, "MOUSEEVENTF_LEFTDOWN", 0, 0, 0, 0)

Do you think this goes under bug report, of this could be solved with click function ? In this case, what do I miss ? is 1000 the right ID for track list ?
X-Raym is offline   Reply With Quote
Old 11-24-2020, 10:19 AM   #1388
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

Can someone test this on Linux? It seems it returns nil ?
Code:
reaper.APIExists("JS_ReaScriptAPI_Version")
Installing jsapi with reapack, is it the latest version in reapack?
heda is offline   Reply With Quote
Old 11-24-2020, 10:33 AM   #1389
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@heda
Why not just use this



Code:
if reaper.JS_ReaScriptAPI_Version then
X-Raym is offline   Reply With Quote
Old 11-24-2020, 10:42 AM   #1390
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by X-Raym View Post
@heda
Why not just use this



Code:
if reaper.JS_ReaScriptAPI_Version then
Yes

edit:
Hm..heda's code shouldn't return nil though if js Api is properly installed I think.
(I don't have Linux to test.)

Last edited by nofish; 11-24-2020 at 10:51 AM.
nofish is offline   Reply With Quote
Old 11-24-2020, 03:51 PM   #1391
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by X-Raym View Post
Code:
h = reaper.JS_Window_HandleFromAddress( 1000 )
reaper.JS_WindowMessage_Send(      h, "MOUSEEVENTF_LEFTDOWN", 0, 0, 0, 0)

Do you think this goes under bug report, of this could be solved with click function ? In this case, what do I miss ? is 1000 the right ID for track list ?
JS_Window_HandleFromAddress isn't the appropriate function. Try JS_Window_FindChildByID.
juliansader is offline   Reply With Quote
Old 11-24-2020, 03:55 PM   #1392
rstockm
Human being with feelings
 
rstockm's Avatar
 
Join Date: May 2012
Location: Berlin, Germany
Posts: 171
Default JS for ARM?

Hi,
is there a chance to get an ARM Version of this library for the new Apple Silicon Macs? It‘s the one piece missing for our Ultraschall project to get an all-ARM
Release up and running...
rstockm is offline   Reply With Quote
Old 11-24-2020, 04:43 PM   #1393
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
JS_Window_HandleFromAddress isn't the appropriate function. Try JS_Window_FindChildByID.

Hmmmm child from what ? And what child ID ?
(thx for exploring this!)
X-Raym is offline   Reply With Quote
Old 11-25-2020, 03:54 AM   #1394
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by rstockm View Post
Hi,
is there a chance to get an ARM Version of this library for the new Apple Silicon Macs? It‘s the one piece missing for our Ultraschall project to get an all-ARM
Release up and running...
I'm not sure whether it is possible yet to compile the plugin for ARM64, but I'll take a look. I don't have an M1 Mac myself, so I need to use some online compiler such as Travis-CI.
juliansader is offline   Reply With Quote
Old 11-25-2020, 04:01 AM   #1395
rstockm
Human being with feelings
 
rstockm's Avatar
 
Join Date: May 2012
Location: Berlin, Germany
Posts: 171
Default

Quote:
Originally Posted by juliansader View Post
I'm not sure whether it is possible yet to compile the plugin for ARM64, but I'll take a look. I don't have an M1 Mac myself, so I need to use some online compiler such as Travis-CI.
Excellent. Please let me know, If I can assist in any way.
rstockm is offline   Reply With Quote
Old 11-25-2020, 05:12 AM   #1396
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by X-Raym View Post
Hmmmm child from what ? And what child ID ?
(thx for exploring this!)

This will give you the TCPDisplay window:
Code:
local main = reaper.GetMainHwnd()
TCPDisplay = reaper.JS_Window_FindEx( main, main, "REAPERTCPDisplay", "" )

You can't find it with JS_Window_FindChildByID because it doesn't have a Control ID.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-25-2020, 06:08 AM   #1397
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@amalgama
Oh that's a step in the right direction thx !


It doesn't solve my issue would this be correct to send a mouse event left down (without up) at mouse cursor position on the TCPdisplay (track fader for eg )

Code:
      reaper.JS_WindowMessage_Send(      TCPDisplay, "MOUSEEVENTF_LEFTDOWN", 0, 0, 0, 0)

But maybe it is an issue with reaper track change layout function.
X-Raym is offline   Reply With Quote
Old 11-25-2020, 08:54 AM   #1398
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by X-Raym View Post
It doesn't solve my issue would this be correct to send a mouse event left down (without up) at mouse cursor position on the TCPdisplay (track fader for eg )

Code:
      reaper.JS_WindowMessage_Send(      TCPDisplay, "MOUSEEVENTF_LEFTDOWN", 0, 0, 0, 0)
Is "MOUSEEVENTF_LEFTDOWN" / mouse_event function supported in JS_API?

Maybe something like,..

Code:
local tcp_hwnd = reaper.JS_Window_FindEx(reaper.GetMainHwnd(), nil, "REAPERTCPDisplay", "") -- get TCP hwnd
if tcp_hwnd then
  local x, y = reaper.GetMousePosition()
  if tcp_hwnd == reaper.JS_Window_FromPoint(x,y) then -- mouse is inside TCP area
    x, y = reaper.JS_Window_ScreenToClient(tcp_hwnd, x, y) -- convert coords to TCP client
    reaper.JS_WindowMessage_Send(tcp_hwnd, "WM_LBUTTONDOWN", 1, 0, x, y) -- hold left button down
  end
end
Note left mouse button will stay down until a physical mouse click or you send a UP msg.
Edgemeal is offline   Reply With Quote
Old 11-25-2020, 09:44 AM   #1399
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Or:
Code:
local TCPDisplay = reaper.JS_Window_FindEx( reaper.GetMainHwnd(), nil, "REAPERTCPDisplay", "" )
reaper.JS_WindowMessage_Post(TCPDisplay, "WM_LBUTTONDOWN", 1, 0, 10, 10)
reaper.JS_WindowMessage_Post(TCPDisplay, "WM_LBUTTONUP", 0, 0, 10, 10)
(will click on the first visible track)

Haven't tested with your script, but maybe this could work too?
Code:
reaper.SetCursorContext( 0, nil )
reaper.TrackList_AdjustWindows( false )
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 11-25-2020 at 11:06 AM.
amagalma is offline   Reply With Quote
Old 11-25-2020, 11:04 AM   #1400
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by juliansader View Post
I'm not sure whether it is possible yet to compile the plugin for ARM64, but I'll take a look. I don't have an M1 Mac myself, so I need to use some online compiler such as Travis-CI.
SWS does (will probably do) macOS arm64 builds using AppVeyor (and now also the other macOS builds because Travis-CI macOS builds are no longer unlimited free for open source projects).

Last edited by nofish; 11-25-2020 at 03:52 PM.
nofish 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 12:37 PM.


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