|
|
|
04-12-2019, 07:10 PM
|
#401
|
Human being with feelings
Join Date: Dec 2018
Posts: 41
|
Ohh Sexan, you are my hero!Making of history here!
|
|
|
04-12-2019, 08:04 PM
|
#402
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,009
|
Here's a bugfix for https://forum.cockos.com/showthread.php?t=219358
Code:
diff --git a/js_ReaScriptAPI/Source code/js_ReaScriptAPI.cpp b/js_ReaScriptAPI/Source code/js_ReaScriptAPI.cpp
index fe5148b..ff3c75a 100644
--- a/js_ReaScriptAPI/Source code/js_ReaScriptAPI.cpp
+++ b/js_ReaScriptAPI/Source code/js_ReaScriptAPI.cpp
@@ -187,7 +187,7 @@ int JS_VKeys_Callback(MSG* event, accelerator_register_t*)
break;
}
- if ((VK_Intercepts[keycode] != 0) && (uMsg != WM_KEYUP) && (uMsg != WM_SYSKEYUP)) // Block keystroke, but not when releasing key
+ if (keycode < 256 && (VK_Intercepts[keycode] != 0) && (uMsg != WM_KEYUP) && (uMsg != WM_SYSKEYUP)) // Block keystroke, but not when releasing key
return 1; // Eat keystroke
else
return 0; // "Not my window", whatever this means?
|
|
|
04-13-2019, 02:03 AM
|
#403
|
Human being with feelings
Join Date: Aug 2011
Posts: 529
|
Quote:
Originally Posted by Sexan
You da maaaaaan! Working beautifully!
EDIT: Updated version on Github if anyone wants to play with it (you can only delete stuff ATM, but maybe someone is really excited about that.... you never know...)
Thank you very much Julian! da maaaaaaaan!
And it's not even hitting ANY cpu
|
Looking promising! Yay!
Would be very nice if the rectangle could grab the items inside any folder and subfolders. Just dreaming...
|
|
|
04-13-2019, 02:22 AM
|
#404
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
it already grabs every item on every track, it looks what is under it
Or am I missing something here?
If you mean SELECTING them, that is just 1 line of code to add, but currently I'm implementing basic functionality how the core of the script should behave. This deleting stuff in there is just for testing. There is still work to be done just on "rectangle" part
Anyway it is time for a separate dedicated thread
Last edited by Sexan; 04-13-2019 at 02:28 AM.
|
|
|
04-13-2019, 03:18 AM
|
#405
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Justin
|
It's an honor to get a bugfix from Justin Himself!
v0.984 uploaded with the hotfix.
WARNING: It seems that macOS (and perhaps Linux?) can send keyboard key codes that fall outside the standard range of Windows key codes. The JS_VKeys functions will not detect or intercept these keys.
Last edited by juliansader; 04-13-2019 at 12:20 PM.
|
|
|
04-13-2019, 03:45 AM
|
#406
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 10,088
|
Quote:
Would be very nice if the rectangle could grab the items inside any folder and subfolders. Just dreaming...
|
This would allow selecting items right from the folder faintpeak... interesting. Not sure how useful it can be but... interesting ^^
|
|
|
04-16-2019, 05:11 AM
|
#407
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 572
|
I have a question about JS_Dialog_BrowseForOpenFiles. I set the argue "allowMultiple " to true. But when I selected a bunch of files, it only returned a path, but without any filenames. Did I do anything wrong?
Code:
retval, filenames = reaper.JS_Dialog_BrowseForOpenFiles("a", "E:/test/", "*.txt", "*.txt", true)
Last edited by dsyrock; 04-16-2019 at 05:18 AM.
|
|
|
04-16-2019, 05:26 AM
|
#408
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 10,088
|
@dyrock
You have to parse the results with null characte (the code snippet is on this thread),
If I remeber correctly, IDE console and message cobsole doesnt display characters after a null.
But maybe it is another problem.
|
|
|
04-16-2019, 05:59 AM
|
#409
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by juliansader
v0.982 has been uploaded, with new audio functions by Xenakios!
(Except for Linux x64, since I haven't been able to figure out how to get Travis CI to compile with std=c++14 on Linux x64.)
EDIT: Got Linux x64 working.
|
The C++14 requirement probably comes from the std::make_unique calls, which are not really that necessary. (Or a replacement function can be trivially written.)
Has anyone tried the audio preview function yet? Bugs found, feature requests?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
04-16-2019, 07:54 AM
|
#410
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
@Julian some users experience errors :
attempt to call a nil value (field 'JS_LICE_CreateBitmap')
attempt to call a nil value (field 'JS_Window_Find')
Is this related to JS_API version (I'm using your latest one from github which is also mentioned in requirements) or platform?
|
|
|
04-16-2019, 09:32 AM
|
#411
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Can the users post a more detailed error message? (Including the line number?)
Off the top of my head, 1) do those calls have a "reaper." prefix?, 2) do the users have the ReaScriptAPI extension installed?
|
|
|
04-16-2019, 09:34 AM
|
#412
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
They cannot even start my new script, it just spits that two errors
https://raw.githubusercontent.com/Go...ha/Area_51.lua
This is the script that you used to find the blitting solution,they cant even start it (its just two users for now)
|
|
|
04-16-2019, 09:39 AM
|
#413
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
My guess is that they don't have the extension installed. Can you ask them to double check?
|
|
|
04-16-2019, 09:43 AM
|
#414
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,707
|
Quote:
Originally Posted by Sexan
|
You could add to the scripts some sanity checks, like:
if reaper.JS_ReaScriptAPI_Version==nil then reaper.MB("Please install JS-extension", "Error", 0) end
or something like that.
BTW: I noticed in the script, that you don't check for the correct localised names of the hwnds. This would be a very good idea to check against, as this could otherwise be a big problem for users with translation-files installed.
|
|
|
04-16-2019, 09:43 AM
|
#415
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
Will do, btw this version with function Compositing is not live on ReaPack?
|
|
|
04-16-2019, 09:46 AM
|
#416
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
Quote:
Originally Posted by mespotine
You could add to the scripts some sanity checks, like:
if reaper.JS_ReaScriptAPI_Version==nil then reaper.MB("Please install JS-extension", "Error", 0) end
or something like that.
BTW: I noticed in the script, that you don't check for the correct localised names of the hwnds. This would be a very good idea to check against, as this could otherwise be a big problem for users with translation-files installed.
|
Yeah I am aware of that, what is the easiest way to convert them to proper ID?
|
|
|
04-16-2019, 09:53 AM
|
#417
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,707
|
Quote:
Originally Posted by Sexan
Yeah I am aware of that, what is the easiest way to convert them to proper ID?
|
This is, how I do it in my API for getting the ReaScriptconsole.
This code also checks, whether there are some specific hwnds in there, to separate it from a potential conflict with gfx-windows with the same name.
Code:
function ultraschall.GetReaScriptConsoleWindow()
--[[
<US_DocBloc version="1.0" spok_lang="en" prog_lang="*">
<slug>GetReaScriptConsoleWindow</slug>
<requires>
Ultraschall=4.00
Reaper=5.965
JS=0.963
Lua=5.3
</requires>
<functioncall>HWND reascript_console_hwnd = ultraschall.GetReaScriptConsoleWindow()</functioncall>
<description>
Returns the hwnd of the ReaScript-Console-window, if opened.
returns nil when ReaScript-console isn't opened
</description>
<retvals>
HWND reascript_console_hwnd - the window-handler to the ReaScript-console, if opened
</retvals>
<chapter_context>
User Interface
Window Management
</chapter_context>
<target_document>US_Api_Documentation</target_document>
<source_document>ultraschall_functions_engine.lua</source_document>
<tags>window, get, hwnd, windows, reaper, console</tags>
</US_DocBloc>
]]
-- get localised string
local translation = reaper.JS_Localize("ReaScript console output", "DLG_437")
-- find all windows with the name of "translation"
local retval,Adr=reaper.JS_Window_ListFind(translation, true)
local count2
-- non found? return with error
if retval==0 then ultraschall.AddErrorMessage("GetReaScriptConsoleWindow", "", "ReaConsole-window not opened", -2) return nil end
-- split the addresses of the found hwnds
local count2, individual_values2 = ultraschall.CSV2IndividualLinesAsArray(Adr)
-- check, whether one of them is a valid one, eg has the correct childhwnds in them
-- if yes, return the hwnd
for i=1, count2 do
local B=reaper.JS_Window_HandleFromAddress(individual_values2[i])
if ultraschall.HasHWNDChildWindowNames(B, "Clear\0Close")==true then return B end
end
ultraschall.AddErrorMessage("GetReaScriptConsoleWindow", "", "ReaConsole-window not opened", -2)
return nil
end
Finding the proper section is more difficult. Best is to work with an untranslated translation-file and rename the windownames in them. Reload the altered translation-file by restarting Reaper and look for the changed windowname.
This is only necessary, if there are multiple entries with the same name in the translation-file. If you find a windowname only once in a translationfile, you can just use that one.
I'm currently documenting all childhwnds of all of Reaper's windows, and this will include the correct localize-sections as well. But this will take some more time to do it as Reaper has tons of them.
So in the meantime, trial and error using a translationfile is the only way...
You can find them in the localise-thread in the pre-release-forum.
|
|
|
04-16-2019, 10:00 AM
|
#418
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
Thank you very much!
|
|
|
04-16-2019, 11:04 AM
|
#419
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
Will do, btw this version with function Compositing is not live on ReaPack?
|
It should be live on ReaPack. On my system, ReaPack shows that the most recent version is 0.984.
|
|
|
04-16-2019, 11:14 AM
|
#420
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by dsyrock
I have a question about JS_Dialog_BrowseForOpenFiles. I set the argue "allowMultiple " to true. But when I selected a bunch of files, it only returned a path, but without any filenames. Did I do anything wrong?
|
As X-Raym mentioned, please check out the discussion here, and some other posts earlier in the thread.
Zero-separated strings have confused other new users too, so I should probably mention something in the API help.
|
|
|
04-16-2019, 06:36 PM
|
#421
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 572
|
Quote:
Originally Posted by juliansader
As X-Raym mentioned, please check out the discussion here, and some other posts earlier in the thread.
Zero-separated strings have confused other new users too, so I should probably mention something in the API help.
|
Thanks, juliansader and X-raym!
|
|
|
04-16-2019, 10:46 PM
|
#422
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 572
|
@juliansader
One more thing about JS_Dialog_BrowseForOpenFiles:
I run this script
Code:
local check, names = reaper.JS_Dialog_BrowseForOpenFiles("", "E:/test/", "*.txt", "*.txt", true)
for v in names:gmatch("[^\0]*") do
reaper.ShowConsoleMsg(v .. "\n")
end
As you mentioned before, when I seleted multy files, the first result in this script is the file path "E:\test\". I tried it on win8.1 and win10, it showed the path correctly. But When I tried it on Win8.0, the result was "E:\test", a "\"at the end was missing.
Last edited by dsyrock; 04-17-2019 at 12:21 AM.
|
|
|
04-17-2019, 12:41 PM
|
#423
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,793
|
|
|
|
04-18-2019, 08:10 AM
|
#424
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by dsyrock
As you mentioned before, when I seleted multy files, the first result in this script is the file path "E:\test". I tried it on win8.1 and win10, it showed the path correctly. But When I tried it on Win8.0, the result was "E:\test", a ""at the end was missing.
|
This is not supposed to happen. Since v0.970, the extension is supposed to add a backslash to the path, even if Windows' dialog window itself doesn't return one.
Could you please send me the entire returned string? You could add the following to your test script:
Code:
for i = 1, #names do
reaper.ShowConsoleMsg(names:byte(i) .. " ")
end
|
|
|
04-18-2019, 09:55 AM
|
#425
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 572
|
Quote:
Originally Posted by juliansader
Could you please send me the entire returned string? You could add the following to your test script:
Code:
for i = 1, #names do
reaper.ShowConsoleMsg(names:byte(i) .. " ")
end
|
I select two files
Code:
E:\test\1.txt
E:\test\2.txt
This is the result on Win10:
Code:
69 58 92 116 101 115 116 92 0 49 46 116 120 116 0 50 46 116 120 116
This is the result on Win8.0
Code:
69 58 92 116 101 115 116 0 49 46 116 120 116 0 50 46 116 120 116
Last edited by dsyrock; 04-18-2019 at 06:47 PM.
|
|
|
04-20-2019, 02:42 AM
|
#426
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by dsyrock
This is the result on Win8.0
|
This is very strange. Are you using the most recent version 0.984?
|
|
|
04-20-2019, 04:22 AM
|
#427
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 572
|
Quote:
Originally Posted by juliansader
This is very strange. Are you using the most recent version 0.984?
|
I'm sorry. I updated it a few days before by reapack, and it downloaded the version 0.981. I'll test it again.
OK, the result on Windows8.0 is crect now after I undating it again.
Code:
69 58 92 116 101 115 116 92 0 49 46 116 120 116 0 50 46 116 120 116
|
|
|
04-28-2019, 06:08 AM
|
#428
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,130
|
@Julian
I want to move a floating track FX window in the center of the screen, when it has been shown. For now, I'm doing it like this:
Code:
reaper.TrackFX_SetOpen(track, slot, true) -- show GUI of VSTi
repeat -- wait and let time pass until the plugin GUI has opened (time varies depending on the plugin)
until (reaper.TrackFX_GetOpen(track, slot) == true)
got_val_ok, width, height = reaper.JS_Window_GetClientSize(reaper.JS_Window_GetForeground()) -- get size of plugin GUI
if got_val_ok then -- if retrieving the plugin size values did work
reaper.JS_Window_Move(reaper.JS_Window_GetForeground(), math.ceil(screen_w/2-width/2), math.ceil(screen_h/2-height/2)) -- move plugin GUI to the horizontal and vertical center of the screen
end
However, some plugins seem to lose "foreground", when they are intialized for the first time. Is there a more reliable way to get the plugin window when it is shown?
|
|
|
04-28-2019, 07:26 AM
|
#429
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 4,034
|
You should probably only get foreground once, store in variable, and if valid then use it,...
Code:
...
local fgw = reaper.JS_Window_GetForeground()
if fgw then
local got_val_ok, width, height = reaper.JS_Window_GetClientSize(fgw) -- get size of plugin GUI
if got_val_ok then -- if retrieving the plugin size values did work
reaper.JS_Window_Move(fgw, math.ceil(screen_w/2-width/2), math.ceil(screen_h/2-height/2)) -- move plugin GUI to the horizontal and vertical center of the screen
end
end
Other idea is to create a string of the expected window title text and Find it after the window has been opened, So for floating fx windows something like,..
Code:
...
-- create string similar to expected window title text and Find it.
local retval, name = reaper.TrackFX_GetFXName(track, slot, "")
local title = name .. ' - Track ' .. tostring(reaper.CSurf_TrackToID(track, false))
local hwnd = reaper.JS_Window_Find(title, true)
if hwnd then
local got_val_ok, width, height = reaper.JS_Window_GetClientSize(hwnd) -- get size of plugin GUI
if got_val_ok then -- if retrieving the plugin size values did work
reaper.JS_Window_Move(hwnd, math.ceil(screen_w/2-width/2), math.ceil(screen_h/2-height/2)) -- move plugin GUI to the horizontal and vertical center of the screen
end
end
Last edited by Edgemeal; 04-28-2019 at 07:39 AM.
Reason: code indents
|
|
|
04-28-2019, 07:27 AM
|
#430
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,130
|
Oh Edgemeal to the help! Thank you mate, gonna try that and report back!
|
|
|
04-29-2019, 06:41 AM
|
#431
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 10,088
|
@edgemeal
Do you think we can have a shortcut for media explorer Edit Custom Tags menu entry from databases ?
Currently, we have to either double click on custom tag column entry,
or to right click item etc...
an overkill way of doing that would be to see what file is selected and to parse databse file to inject the data from there and refresh explorer. I have database scripts already but if is possible to trigger that action without having all this parsing, it would be way more efficient.
Thx for your expertise !
|
|
|
04-29-2019, 10:07 AM
|
#432
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 4,034
|
@ X-Raym, Sorry, not sure thats possible. Maybe ask REAPER developers for some new Media Explorer actions!
|
|
|
04-29-2019, 10:17 AM
|
#433
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 10,088
|
@edgemeal
Thx : will do :P
|
|
|
04-29-2019, 01:51 PM
|
#434
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,130
|
@Edgemeal: that 2nd solution did the trick, amazing. Thank you! You are the window-king
Will be incorporated in my "Add or replace VSTi" bundle.
|
|
|
04-30-2019, 01:59 PM
|
#435
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
v0.985 of the extension uploaded:
* VKeys: Using some undocumented prestidigitation, keyboard intercepts are now first in keyboard processing queue, so will work properly in MIDI editor too. (Global shortcuts are probably still ahead, so may override scripts.)
* VKeys: Deprecate GetHistory, new functions GetDown and GetUp, and new parameter cutoffTime. (Google and Github searches did not find any public scripts using the VKeys functions yet, so I trust I'm not inconveniencing anyone with these changes. The new functions work well in my own scripts, particularly to achieve "continuous push shortcuts" that X-Raym mentioned above.)
* BrowseForOpenFiles: On WindowsOS, prevent creation of new files. (Oops, I forgot about this request when I started to work on the new Composite and VKeys functions.)
|
|
|
05-01-2019, 04:04 AM
|
#436
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,178
|
Thank you as always
I would still *love* a way of somehow saving an image (bitmap) to disk (providing a filename - so can be completely automated).
|
|
|
05-01-2019, 10:53 AM
|
#437
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by lb0
I would still *love* a way of somehow saving an image (bitmap) to disk (providing a filename - so can be completely automated).
|
Quote:
Originally Posted by Breeder
Take a screenshot of a project (or maybe just the arrange and mixer window - alt+prtscreen type...maybe all 3...screenshot of the screen, arrange and mixer...that would enough information for later overview), save it in the project audio folder and import into media bay (so it doesn't get deleted on project cleanup)
|
Is transparency important for your bitmaps?
I have spent an embarrassing amount of time trying to get png writing to work, but I can't get libpng to link properly.
However, this afternoon I tried writing jpegs with jpeglib, and it compiled and worked immediately.
Last edited by juliansader; 05-01-2019 at 11:47 AM.
|
|
|
05-01-2019, 01:18 PM
|
#438
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,178
|
Quote:
Originally Posted by juliansader
Is transparency important for your bitmaps?
I have spent an embarrassing amount of time trying to get png writing to work, but I can't get libpng to link properly.
However, this afternoon I tried writing jpegs with jpeglib, and it compiled and worked immediately.
|
Sounds great!
Transparency probably not essential. Thank you for taking the time to look into it.
JPG's should be ok too.
EDIT:
To give you a little perspective on my initial plans for a function like this - In Stripper I can save strip files - and use a strip browser to drag strips in.
The browser will show a thumbnail bitmap from the same folder the strip is located in if it exists. Currently - I have to do a traditional screen grab, crop, and manual save which is time consuming and to be honest - I tend not to bother. With a function such as this - I can create the bitmap of the full size strip (currently would be using reaper's bitmaps - hopefully these can be translated somehow into suitable one's I can use with any potential function - even if I have to first blit it onto the GUI- that would be ok). I'd scale it down to an appropriate size and save it alongside the strip.
Then voila! Pretty pictures for each strip.
I'm sure I could think of many other useful applications too.
Last edited by lb0; 05-01-2019 at 01:36 PM.
|
|
|
05-02-2019, 04:36 AM
|
#439
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by juliansader
I have spent an embarrassing amount of time trying to get png writing to work, but I can't get libpng to link properly.
|
Do you mean you have tried linking with a prebuilt libpng? Cockos's WDL comes with the libpng sources to allow Lice to use png images, so it should be possible to just compile the needed source files directly with your project. (There are a lot of needed files, though, because libpng also requires at least zlib too...It would be better if the Reaper API itself had functions to save image files from Lice bitmaps etc.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
05-02-2019, 08:49 AM
|
#440
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,707
|
Noticed just yesterday, that the JS_Window_Find-function stopped working on Mac in the 0.980-release. It can't find the Render to File-dialog(maybe others as well?)
I reverted back to 0.972 and everything worked fine again with the same code and conditions.
This might be the case with other such functions as well, but hadn't time to check them yet...
|
|
|
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 08:33 AM.
|