Old 06-22-2020, 04:11 PM   #1281
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

How does SWS do it? They have arm-builds as well.
__________________
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 06-27-2020, 12:46 PM   #1282
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Hey folks!
I try to use the JS_VKeys_GetState function in eel.

In lua, it works well with these lines:

function main()
if reaper.JS_VKeys_GetState(0):byte(0x0D) ~= 0 then -- Return Key
Print("hello")
end
reaper.defer(main)
end

main()

But in eel I can't find what is the equivalent of the string.byte function.
Any help will be greatly appreciated! :-)
Infrabass is offline   Reply With Quote
Old 06-30-2020, 05:47 PM   #1283
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

JS_Mouse_SetPosition seems not to work on macOS. It does not move the mouse cursor
__________________
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 07-03-2020, 01:32 PM   #1284
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by amagalma View Post
JS_Mouse_SetPosition seems not to work on macOS. It does not move the mouse cursor
I hope this isn't another OSX swell or Metal bug. Which OS version are you using? It works fine on my High Sierra.

Are you running the function inside a deferred loop or perhaps and while loop? What happens when you run a single-line script with only JS_Mouse_Setposition?
juliansader is offline   Reply With Quote
Old 07-03-2020, 01:43 PM   #1285
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Infrabass View Post
But in eel I can't find what is the equivalent of the string.byte function.
Any help will be greatly appreciated! :-)
I'm not familiar with EEL, but since no-one else has answered, I looked through the EEL API and found str_getchar:
https://www.extremraym.com/cloud/rea...el_str_getchar
juliansader is offline   Reply With Quote
Old 07-03-2020, 01:44 PM   #1286
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by juliansader View Post
I hope this isn't another OSX swell or Metal bug. Which OS version are you using? It works fine on my High Sierra.

Are you running the function inside a deferred loop or perhaps and while loop? What happens when you run a single-line script with only JS_Mouse_Setposition?

Catalina, but on VMWare... Just a single line script: reaper.JS_Mouse_SetPosition( 100, 100 )
__________________
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 07-04-2020, 05:02 PM   #1287
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by amagalma View Post
Catalina, but on VMWare... Just a single line script: reaper.JS_Mouse_SetPosition( 100, 100 )
If anyone else that uses macOS is reading this, I would appreciate it if you could try that single-line script, to check if the problem can be reproduced on other systems.
juliansader is offline   Reply With Quote
Old 07-05-2020, 03:11 AM   #1288
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Works here, MacBook Early 2011, High Sierra:
https://nextcloud.stephanroemer.net/...7eC4yGAQpetHY7

However, I have an issue with the Draw Ramp tool in OSX (Script: js_Mouse editing - Draw ramp.lua), as seen in this GIF.
The mouse cursor jumps from top to bottom very quickly:
https://nextcloud.stephanroemer.net/...iCrKJ6RsXgSkHa
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom

Last edited by _Stevie_; 07-05-2020 at 03:17 AM.
_Stevie_ is offline   Reply With Quote
Old 07-10-2020, 06:25 AM   #1289
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I have a question about intercepting keyboard-messages.

I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.

Now here's my problem: how can I do that?

Code:
gfx.init()

function main()
  Key=gfx.getchar()
  if Key~=-1 and Key~=13 and Key~=27 and Key~=32 then
    -- What do I need to write in this if-branch?
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is sent to the Arrangeview")
  else
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is treated in gfx-window and not sent to Arrangeview")  
  end
  reaper.defer(main)
end

main()
__________________
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 07-10-2020, 06:26 AM   #1290
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

How owuld one send an "ENTER" to a window? The hexadecimal value is 0x0D accroding to this site: https://docs.microsoft.com/en-us/win...tual-key-codes

I tried this:

Code:
 
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_KEYDOWN", 0x0D, 0, 0, 0)
But doesnt seem to work, even though the script saves & compiles ok in IDE.
reapero is offline   Reply With Quote
Old 07-10-2020, 06:35 AM   #1291
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by reapero View Post
How owuld one send an "ENTER" to a window? The hexadecimal value is 0x0D accroding to this site: https://docs.microsoft.com/en-us/win...tual-key-codes

I tried this:

Code:
 
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_KEYDOWN", 0x0D, 0, 0, 0)
But doesnt seem to work, even though the script saves & compiles ok in IDE.
I tried using JS_WindowMessage_Post instead and the following code triggers a lot of actions through that:

Code:
hwnd=reaper.GetMainHwnd()

i=0

function main()
  ret  = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", i,0,0,0)
  i=i+1
  reaper.ShowConsoleMsg("")
  reaper.ShowConsoleMsg(i)
  reaper.defer(main)
end

main()
Though I haven't found out, which one is for Enter, but maybe this helps you in a way...

Edit:
13 does the trick, which is the same as 0x0D

Edit2:
Hmm, only when used in a defer-cycle, but not if in a regular script. This is odd O_O

Edit3:
Its even weirder, sometimes it triggers after the third time sending the message, sometimes after the fourth, sometimes way above 20 times sending the message. And only in defer-loops, not in non deferred-scripts.
I can not make any sense of that.

This sometimes works, sometimes not...
Code:
hwnd=reaper.GetMainHwnd()

o=0
function main()
  ret  = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)

  if o<20 then reaper.defer(main) o=o+1 end
end

main()
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 07-10-2020 at 06:48 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-10-2020, 06:39 AM   #1292
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I have a question about intercepting keyboard-messages.

I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.

Now here's my problem: how can I do that?

Code:
gfx.init()

function main()
  Key=gfx.getchar()
  if Key~=-1 and Key~=13 and Key~=27 and Key~=32 then
    -- What do I need to write in this if-branch?
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is sent to the Arrangeview")
  else
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is treated in gfx-window and not sent to Arrangeview")  
  end
  reaper.defer(main)
end

main()
Not at the computer right now, but you would use https://www.extremraym.com/cloud/rea...VKeys_GetState to get the current key state and compare it with the desired values.

Edit, sorry, of course you also need to intercept the keys:
https://www.extremraym.com/cloud/rea...Keys_Intercept
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 07-10-2020, 06:50 AM   #1293
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by _Stevie_ View Post
Not at the computer right now, but you would use https://www.extremraym.com/cloud/rea...VKeys_GetState to get the current key state and compare it with the desired values.

Edit, sorry, of course you also need to intercept the keys:
https://www.extremraym.com/cloud/rea...Keys_Intercept
The problem is, and it's close to reapero's problem as well, is not getting the keys, but sending them to the Reaper-window. This seems not to be that easy as I thought it could be...
__________________
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 07-10-2020, 06:59 AM   #1294
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

That’s pretty doable, though. You would basically only intercept the keys that you don’t want to be sent to the reaper window. The other keys will be passed thru.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 07-10-2020, 07:02 AM   #1295
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Edit3:
Its even weirder, sometimes it triggers after the third time sending the message, sometimes after the fourth, sometimes way above 20 times sending the message. And only in defer-loops, not in non deferred-scripts.
I can not make any sense of that.

This sometimes works, sometimes not...
Code:
hwnd=reaper.GetMainHwnd()

o=0
function main()
  ret  = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)

  if o<20 then reaper.defer(main) o=o+1 end
end

main()
Confirmed..this actually triggered ENTER in the other window. Is this possibly an API bug then?
reapero is offline   Reply With Quote
Old 07-10-2020, 07:21 AM   #1296
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

In most cases you'll want to send an "up" message after sending a "down" message, otherwise it might screw up how the keyboard interacts with the app and/or OS. And if you launch a script from a keyboard shortcut it most likely will interfere with the key your trying to send.

I haven't done much key sending but trying to send a BackSpace key to the search field of Explorer I ended up having to POST (not Send) just the key up message for it to work as expected. So you need to experiment I guess for your target window.

Code:
local VK_BACK = 0x8 -- backspace key
local explorer = reaper.OpenMediaExplorer("", false) 
if not explorer then --not-docked and closed
  reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
  explorer = reaper.OpenMediaExplorer("", false)
end 
local search = reaper.JS_Window_FindChildByID(explorer, 1015)
if search then
  if not reaper.JS_Window_IsVisible(search) then -- when docked but not visible
    reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer 
  end
  -- send backspace key to Explorer search feild textbox
  reaper.JS_WindowMessage_Post(search, "WM_KEYUP", VK_BACK, 0,0,0)
end
Edgemeal is offline   Reply With Quote
Old 07-10-2020, 07:25 AM   #1297
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Edgemeal View Post
In most cases you'll want to send an "up" message after sending a "down" message, otherwise it might screw up how the keyboard interacts with the app and/or OS. And if you launch a script from a keyboard shortcut it most likely will interfere with the key your trying to send.

I haven't done much key sending but trying to send a BackSpace key to the search field of Explorer I ended up having to POST (not Send) just the key up message for it to work as expected. So you need to experiment I guess for your target window.

Code:
local VK_BACK = 0x8 -- backspace key
local explorer = reaper.OpenMediaExplorer("", false) 
if not explorer then --not-docked and closed
  reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer
  explorer = reaper.OpenMediaExplorer("", false)
end 
local search = reaper.JS_Window_FindChildByID(explorer, 1015)
if search then
  if not reaper.JS_Window_IsVisible(search) then -- when docked but not visible
    reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer 
  end
  -- send backspace key to Explorer search feild textbox
  reaper.JS_WindowMessage_Post(search, "WM_KEYUP", VK_BACK, 0,0,0)
end
I had experimented with WM_KEYDOWN as well, but it didn't change, at least on Windows.

I also tried WM_KEYFIRST and WM_KEYLAST but it didn't work either.
__________________
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 07-10-2020, 07:41 AM   #1298
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Just tried with "WM_KEYUP" and doesnt seem to work either. It doesn´t work inside a defer loop, unlike WM_KEYDOWN.

Sending WM_KEYDOWN and then WM_KEYUP outside of the loop didnt work either.
reapero is offline   Reply With Quote
Old 07-10-2020, 08:33 AM   #1299
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

What window is it, is it something in REAPER we can all easily test? And if possible can you post the code you're using to get the window handle, send the key, etc.
Edgemeal is offline   Reply With Quote
Old 07-10-2020, 09:08 AM   #1300
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Sure. Its cmd. I am sending from a lua script within Reaper to a python script (triggered by a .bat if that matters).

Code:
hwnd = reaper.JS_Window_Find("cmd", false)
 --ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN",0x0D, 0, 0, 0)
 --ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYUP",0x0D, 0, 0, 0)

 o=0
 function main()
   ret  = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN", 0x0D,0,0,0)
 
   if o<20 then reaper.defer(main) o=o+1 end
 end
 
 main()
I commented what didnt work and left Mespotine´s loop there..although this causes some other troubles.
reapero is offline   Reply With Quote
Old 07-10-2020, 10:18 AM   #1301
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

No experience with python, but one thing to try is to set focus on the window before sending the messages to it. Good Luck!
Edgemeal is offline   Reply With Quote
Old 07-10-2020, 12:52 PM   #1302
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by _Stevie_ View Post
However, I have an issue with the Draw Ramp tool in OSX (Script: js_Mouse editing - Draw ramp.lua), as seen in this GIF.
The mouse cursor jumps from top to bottom very quickly:
Please check if this has been fixed in the recent update.
juliansader is offline   Reply With Quote
Old 07-10-2020, 12:55 PM   #1303
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I have a question about intercepting keyboard-messages.

I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.
Some time ago, another user had the same issue, and my suggested solution is in this this thread: Script Requests for a reasonable $$$.

I am not sure how REAPER's keyboard input is handled "under the hood". Unlike mouse inputs, which are directed to specific windows, can be simulated with WindowMessage_Post/Send, and can be intercepted by WindowMessage_Intercept, REAPER's keyboard inputs seem to enter a global queue, and some key presses (particularly shortcuts, IIRC), do not seem to be handled via window messages.
juliansader is offline   Reply With Quote
Old 07-10-2020, 02:00 PM   #1304
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Does anyone know if there's a way of getting the mouse coordinates of the edit cursor on the arrange page? (mac-friendly coordinates)
Cheers
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 07-10-2020, 03:00 PM   #1305
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Triode View Post
Does anyone know if there's a way of getting the mouse coordinates of the edit cursor on the arrange page? (mac-friendly coordinates)
Cheers
I'm not sure what you mean by "mouse coordinates of the edit cursor"?

To get the x coordinate of the edit cursor:
Code:
editCursorTime = reaper.GetCursorPosition()
arrangeStartTime = reaper.GetSet_ArrangeView2(0, false, 0, 0)
pixelsPerSecond = reaper.GetHZoomLevel()

editCursorXCoordinate = (editCursorTime-arrangeStartTime)*pixelsPerSecond
juliansader is offline   Reply With Quote
Old 07-10-2020, 03:18 PM   #1306
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Lovely thank you I'll give that a try
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 07-11-2020, 04:13 AM   #1307
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Quote:
Originally Posted by juliansader View Post
Please check if this has been fixed in the recent update.
Fixed, thanks man! Fun fact: I seem the only one to test these features on OSX, eventhough OSX is not even my main platform
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 07-11-2020, 11:27 AM   #1308
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Quote:
Originally Posted by juliansader View Post
Some time ago, another user had the same issue, and my suggested solution is in this this thread: Script Requests for a reasonable $$$.

I am not sure how REAPER's keyboard input is handled "under the hood". Unlike mouse inputs, which are directed to specific windows, can be simulated with WindowMessage_Post/Send, and can be intercepted by WindowMessage_Intercept, REAPER's keyboard inputs seem to enter a global queue, and some key presses (particularly shortcuts, IIRC), do not seem to be handled via window messages.
Hey Julian. Forgive my ingorance but for the case i mention above, which is not trying to intercept messages and redirect them, but just to send an ENTER message from the script , the above wouldnt apply no?

Following your script on that message you mentioned and Edgemeal advice, i´ve tried to set the focus before sending the message, but it still didnt work.
Then i´ve tried sending simple messages and looks like "WM_KEYDOWN" wont even send an "a" to cmd, however "WM_CHAR" seems to send it correctly. I cant send ENTER messages with "WM_CHAR", can i?

Here´s the code:

Code:
hwnd = reaper.JS_Window_Find("cmd", false)
reaper.JS_Window_SetFocus(hwnd)
ret = reaper.JS_WindowMessage_Send(hwnd, "WM_CHAR", string.byte("a"), 0, 0, 0)
ret = reaper.JS_WindowMessage_Post(hwnd, "WM_KEYDOWN",0x41, 0, 0, 0)
reapero is offline   Reply With Quote
Old 07-26-2020, 10:45 AM   #1309
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

soo, what function create this boxes that one can see for exemple in JS script ( Multi Tool)

daniellumertz is offline   Reply With Quote
Old 07-27-2020, 01:21 PM   #1310
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by daniellumertz View Post
soo, what function create this boxes that one can see for exemple in JS script ( Multi Tool)
Create a LICE bitmap, composite the bitmap onto a REAPER window, and then draw rectangles or anything else in the LICE bitmap.

In the Multi Tool, I only use one large bitmap, with multiple graphical elements inside the bitmap. Sexan's Area51 script used multiple bitmaps, one for each graphical element / area.
juliansader is offline   Reply With Quote
Old 07-29-2020, 08:53 AM   #1311
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub), and suggested you should decide on one, so you are legally on the safe side.
Otherwise someone could sue you, if they grow a third pair of shoes instead of their noses while using your extension

We use MIT-license, which is quite nice for stuff like that, I think ReaPack uses LGPL or something(dunno what SWS uses).
__________________
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 07-31-2020, 07:08 PM   #1312
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by mespotine View Post
@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub), and suggested you should decide on one, so you are legally on the safe side.
Otherwise someone could sue you, if they grow a third pair of shoes instead of their noses while using your extension

We use MIT-license, which is quite nice for stuff like that, I think ReaPack uses LGPL or something(dunno what SWS uses).
When you don't chose a licence, it means it's "all rights reserved."

Copyright is granted automatically by the law the moment something is created so nobody can sue him unless he himself used something against the copyright which belongs to someone else. He is the sole owner of his work and him picking a licence is not really mandatory. And licence is just an example anyway (albeit a real one if you chose to use it), you can write your own terms etc...
Breeder is offline   Reply With Quote
Old 07-31-2020, 07:13 PM   #1313
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I didn't mean any copyright-issues, but more the "Use it at your own risk"-feature a license has. Like this snippet of the MIT-license:

Quote:
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__________________
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 07-31-2020, 07:16 PM   #1314
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I didn't mean any copyright-issues, but more the "Use it at your own risk"-feature a license has. Like this snippet of the MIT-license:
That's a good point!
Breeder is offline   Reply With Quote
Old 08-02-2020, 05:27 PM   #1315
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
@JulianSader
Someone in our team realised recently again, that your extension still has no license to work with(or at least, we couldn't find one on GitHub),
I am not familiar with the legalities of open source, relatively informal code such as extensions and scripts, but it is not something I would lose sleep over.

If I do add a disclaimer, I'm not sure where it should go? Somewhere in the source code perhaps? Extensions and scripts that are installed via ReaPack do not pop up dialog windows that ask the user to accept T&Cs, and very few users ever look at the source code, particularly of C++ scripts.

I may be totally mistaken, but I don't think that a disclaimer or license that is hidden from the user would carry any legal weight.

The best would probably be if REAPER's own T&Cs include a reference to scripts and extensions, or otherwise ReaPack's.
juliansader is offline   Reply With Quote
Old 08-02-2020, 06:11 PM   #1316
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I think a license.md in the gitrepo and stating it's licensed under a specific license in the ReaPack-description itself would be enough imho.
Though, I add a license into any sourcecodefile I have as well, just in case.
So users recycling my code know, under which conditions it's allowed, giving them more safety in these areas too.
__________________
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 08-23-2020, 07:52 AM   #1317
acendan
Human being with feelings
 
acendan's Avatar
 
Join Date: Jun 2020
Location: Florida, US
Posts: 41
Default Issue Getting Selected Regions

Hey there! Currently running into an issue where users of one of my scripts are reporting a problem processing selected regions in the region/marker manager. It works perfectly as intended on Windows 10, and both users that have reported issues are on Mac. It's just not processing selected regions at all, so presumably the issue is rooted in finding the Region/Marker Manager window on Mac. Beyond that, all of them are on the latest version. Copying the code snippets below, adapted from X-Raym's ReaScript template. Any help would be greatly appreciated!

https://github.com/ReaTeam/ReaScript...%20manager.lua

Code:
function getSelectedRegions()
  local hWnd = getRegionManager()
  if hWnd == nil then return end  
  local container = reaper.JS_Window_FindChildByID(hWnd, 1071)
  sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(container)
  if sel_count == 0 then return end 
  
  names = {}
  i = 0
  for index in string.gmatch(sel_indexes, '[^,]+') do 
    i = i+1
    local sel_item = reaper.JS_ListView_GetItemText(container, tonumber(index), 1)
    if sel_item:find("R") ~= nil then
      names[i] = tonumber(sel_item:sub(2))
    end
  end
  
  -- Return table of selected regions
  return names
end

function getRegionManager()
  local title = reaper.JS_Localize("Region/Marker Manager", "common")
  local arr = reaper.new_array({}, 1024)
  reaper.JS_Window_ArrayFind(title, true, arr)
  local adr = arr.table()
  for j = 1, #adr do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
    -- verify window by checking if it also has a specific child.
    if reaper.JS_Window_FindChildByID(hwnd, 1056) then -- 1045:ID of clear button
      return hwnd
    end 
  end
end
acendan is offline   Reply With Quote
Old 08-23-2020, 10:28 AM   #1318
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by acendan View Post
Hey there! Currently running into an issue where users of one of my scripts are reporting a problem processing selected regions in the region/marker manager. It works perfectly as intended on Windows 10, and both users that have reported issues are on Mac. It's just not processing selected regions at all, so presumably the issue is rooted in finding the Region/Marker Manager window on Mac. Beyond that, all of them are on the latest version. Copying the code snippets below, adapted from X-Raym's ReaScript template. Any help would be greatly appreciated!

https://github.com/ReaTeam/ReaScript...%20manager.lua

Code:
function getSelectedRegions()
  local hWnd = getRegionManager()
  if hWnd == nil then return end  
  local container = reaper.JS_Window_FindChildByID(hWnd, 1071)
  sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(container)
  if sel_count == 0 then return end 
  
  names = {}
  i = 0
  for index in string.gmatch(sel_indexes, '[^,]+') do 
    i = i+1
    local sel_item = reaper.JS_ListView_GetItemText(container, tonumber(index), 1)
    if sel_item:find("R") ~= nil then
      names[i] = tonumber(sel_item:sub(2))
    end
  end
  
  -- Return table of selected regions
  return names
end

function getRegionManager()
  local title = reaper.JS_Localize("Region/Marker Manager", "common")
  local arr = reaper.new_array({}, 1024)
  reaper.JS_Window_ArrayFind(title, true, arr)
  local adr = arr.table()
  for j = 1, #adr do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
    -- verify window by checking if it also has a specific child.
    if reaper.JS_Window_FindChildByID(hwnd, 1056) then -- 1045:ID of clear button
      return hwnd
    end 
  end
end

What is the actual error-message the users got when running this script on Mac?
__________________
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 08-23-2020, 10:43 AM   #1319
acendan
Human being with feelings
 
acendan's Avatar
 
Join Date: Jun 2020
Location: Florida, US
Posts: 41
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
What is the actual error-message the users got when running this script on Mac?
Not reporting any error at all, it's just not doing anything. Which leads me to believe the source of the issue is:

Code:
if hWnd == nil then return end
If I had a mac I'd test it myself. Might be able to get my hands on one within the next day or two. Mostly just probing to see if this is a known problem. Thanks for the help, btw!
acendan is offline   Reply With Quote
Old 08-23-2020, 10:50 AM   #1320
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Could you change all lines ending with
Code:
then return end
to
Code:
then reaper.ShowConsoleMsg("insert useful message in here") return end
and let the user try the script again?

For instance, the line

Code:
if hWnd == nil then return end
could read

Code:
if hWnd == nil then reaper.ShowConsoleMsg("No hwnd found, sorry.") return end
That way we can see, where the script exits at the user and therfore come closer to the actual problem.

Make all shown messages be different.
__________________
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
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:03 AM.


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