generated from cfillion/reapack-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create smandrap_Show-hide media explorer with focus
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- @description Media Explorer: Show/hide media explorer with focus | ||
-- @author smandrap | ||
-- @version 1.0 | ||
-- @donation https://paypal.me/smandrap | ||
-- @about | ||
-- Opens media explorer window and sets focus to it immediately. | ||
-- Requires JS Api | ||
|
||
local reaper = reaper | ||
|
||
local function dependency_check() | ||
if not reaper.JS_ReaScriptAPI_Version() then | ||
local mb = reaper.MB('This script needs JS_API. You want to install it now?', 'Missing dependency', 1) | ||
if mb == 2 then return false end | ||
|
||
if not reaper.APIExists('ReaPack_BrowsePackages') then | ||
mb = reaper.MB('https://reapack.com/', 'Get ReaPack first.', 0) | ||
return false | ||
end | ||
|
||
reaper.ReaPack_BrowsePackages('js_ReaScript API') | ||
end | ||
|
||
return true | ||
end | ||
|
||
|
||
local function main() | ||
reaper.Main_OnCommand(50124, 0) | ||
if reaper.GetToggleCommandState(50124) == 1 then | ||
|
||
local hwnd = reaper.JS_Window_Find("Media Explorer", false) | ||
reaper.JS_Window_SetFocus(hwnd) | ||
|
||
end | ||
end | ||
|
||
if dependency_check() then main() end |