Advertisement
poulhoi

X-Raym_Focus media explorer.lua

Jan 10th, 2021
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. --[[
  2.  * ReaScript Name: Focus media explorer
  3.  * Author: X-Raym
  4.  * Author URI: http://www.extremraym.com/
  5.  * Repository: GitHub > X-Raym > REAPER-ReaScripts
  6.  * Repository URI: https://github.com/X-Raym/REAPER-ReaScripts
  7.  * Licence: GPL v3
  8.  * REAPER: 5.0
  9.  * Version: 1.0
  10. --]]
  11.  
  12. --[[
  13.  * Changelog:
  14.  * v1.0 (2020-12-17)
  15.   + Initial Release
  16. --]]
  17.  
  18. function GetMediaExplorer()
  19.   local title = reaper.JS_Localize("Media Explorer", "common")
  20.   local arr = reaper.new_array({}, 1024)
  21.   reaper.JS_Window_ArrayFind(title, true, arr)
  22.   local adr = arr.table()
  23.   for j = 1, #adr do
  24.     local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
  25.     -- verify window by checking if it also has a specific child.
  26.     if reaper.JS_Window_FindChildByID(hwnd, 1045) then -- 1045:ID of volume control in media explorer.
  27.       return hwnd
  28.     end
  29.   end
  30. end
  31.  
  32. if not reaper.JS_Window_ArrayFind then
  33.   reaper.ShowConsoleMsg('Please Install js_ReaScriptAPI extension.\nhttps://forum.cockos.com/showthread.php?t=212174\n')
  34. else
  35.     hwnd = GetMediaExplorer()
  36.  
  37.     if hwnd then
  38.         reaper.JS_Window_SetFocus( hwnd )
  39.     end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement