Old 09-15-2021, 01:08 AM   #1
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 888
Default Get Info from active Send Window?

Hi folks

Is there a way of getting the receive name (and send track) from the currently active send window?

I mean this window:


Many thanks!
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 09-15-2021, 07:54 AM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,570
Default

Using js_ReaScriptAPI extensin, maybe try something like,..
Code:
local title = reaper.JS_Localize('Controls for track ', 'common')
local hwnd = reaper.JS_Window_FindTop(title, false)
 
if hwnd then 
  local container = reaper.JS_Window_FindChildByID(hwnd, 0) 
  local child = reaper.JS_Window_FindChildByID(container, 1038)
  if child then
    titlebar_text = reaper.JS_Window_GetTitle(hwnd) -- e.g., Controls for track 1 "Drums"
    child_text = reaper.JS_Window_GetTitle(child)   -- e.g., Send to track 3 "Reverb"

    send_track = child_text:match(" to track (%d)")
    recv_track = titlebar_text:match(" for track (%d)")
     
    reaper.ClearConsole()
    reaper.ShowConsoleMsg(titlebar_text .. '\n') 
    reaper.ShowConsoleMsg(child_text .. '\n') 
    reaper.ShowConsoleMsg("send to track #" .. send_track .. '\n') 
    reaper.ShowConsoleMsg("recv from track #" .. recv_track .. '\n') 
  end
end

Last edited by Edgemeal; 09-15-2021 at 08:32 AM. Reason: Change Find to FindTop (since window can't be docked)
Edgemeal is offline   Reply With Quote
Old 09-15-2021, 09:00 AM   #3
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 888
Default

Thank you Edgemeal I'll give that a try
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 09-16-2021, 01:34 AM   #4
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 888
Default

This doesn't seem to work (at least not on mac)
If I set the console to display the child string it comes up with nil.
Maybe it's because the send window opens with the number field highlighted?

Code:
local title = reaper.JS_Localize('Controls for track ', 'common')
local hwnd = reaper.JS_Window_FindTop(title, false)
 
if hwnd then 
  local container = reaper.JS_Window_FindChildByID(hwnd, 0) 
  local child = reaper.JS_Window_FindChildByID(container, 1038)
  
reaper.ClearConsole()
    reaper.ShowConsoleMsg(tostring(child) .. '\n') ---  comes up with "nil"
  
  
  if child then
    titlebar_text = reaper.JS_Window_GetTitle(hwnd) -- e.g., Controls for track 1 "Drums"
    child_text = reaper.JS_Window_GetTitle(child)   -- e.g., Send to track 3 "Reverb"

    send_track = child_text:match(" to track (%d)")
    recv_track = titlebar_text:match(" for track (%d)")
     
    reaper.ClearConsole()
    reaper.ShowConsoleMsg(titlebar_text .. '\n') 
    reaper.ShowConsoleMsg(child_text .. '\n') 
    reaper.ShowConsoleMsg("send to track #" .. send_track .. '\n') 
    reaper.ShowConsoleMsg("recv from track #" .. recv_track .. '\n') 
  end
end
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 09-16-2021, 03:14 AM   #5
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,570
Default

On Win10 here, maybe the window layout is a tad different on MAC, Hopefully the control IDs are the same, then we should be able to loop thru the child windows and find the control with that text, Try this..

Code:
function GetControlsForTrackText()
  local title = reaper.JS_Localize('Controls for track ', 'common')
  local hwnd = reaper.JS_Window_FindTop(title, false) 
  if hwnd then 
    local arr = reaper.new_array({}, 255)
    local ret = reaper.JS_Window_ArrayAllChild(hwnd, arr) 
    local adr = arr.table()
    for j = 1, #adr do
      local child = reaper.JS_Window_HandleFromAddress(adr[j])
      local id = reaper.JS_Window_AddressFromHandle(reaper.JS_Window_GetLongPtr(child, "ID")) 
      if id == 1038 then return reaper.JS_Window_GetTitle(hwnd), reaper.JS_Window_GetTitle(child) end
    end
  end
end


local titlebar_text, child_text = GetControlsForTrackText()
if titlebar_text ~= nil then
  reaper.ShowConsoleMsg(titlebar_text .. '\n') 
  reaper.ShowConsoleMsg(child_text .. '\n') 
end

Last edited by Edgemeal; 09-16-2021 at 03:31 AM.
Edgemeal is offline   Reply With Quote
Old 09-16-2021, 06:08 AM   #6
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 888
Default

That seems to have done the trick for Mac
Many thanks for that
Does it work on windows too btw?
Little donation for snippet sent
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 09-16-2021, 06:15 AM   #7
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,570
Default

Ya, works here on Win10_x64 w/REAPER v6.36.
Thanks for the donation!
Edgemeal 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 04:06 PM.


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