Old 12-21-2018, 07:55 PM   #161
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by amagalma View Post
I wanted to combine it with this script of Edgemeal so that the action gets automatically typed in the open IDE window.
This is crazy, I added this to that script, set the script to use a shortcut with Control key, I'm using Control+F12 and it works LOL! Its like the IDE sees the Control key is down + the V key this script is sending so it does a paste!

Code:
...
reaper.CF_SetClipboard(code) -- copy generated code to clipboard

-- sends text to IDE if open
local hWnd_IDE = reaper.JS_Window_Find(" - ReaScript Development Environment", false)
if hWnd_IDE ~= nil then
 local wdl = reaper.JS_Window_FindChildByID(hWnd_IDE, 1106) 
 reaper.JS_Window_SetFocus(wdl)
 reaper.JS_WindowMessage_Post(wdl, "WM_KEYDOWN", 0x0056, 0, 0, 0) -- V key
 reaper.JS_WindowMessage_Post(wdl, "WM_KEYUP", 0x0056, 0, 0, 0)
end
Edgemeal is offline   Reply With Quote
Old 12-22-2018, 05:41 AM   #162
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,450
Default

Quote:
Originally Posted by Edgemeal View Post
This is crazy, I added this to that script, set the script to use a shortcut with Control key, I'm using Control+F12 and it works LOL! Its like the IDE sees the Control key is down + the V key this script is sending so it does a paste!

Code:
...
reaper.CF_SetClipboard(code) -- copy generated code to clipboard

-- sends text to IDE if open
local hWnd_IDE = reaper.JS_Window_Find(" - ReaScript Development Environment", false)
if hWnd_IDE ~= nil then
 local wdl = reaper.JS_Window_FindChildByID(hWnd_IDE, 1106) 
 reaper.JS_Window_SetFocus(wdl)
 reaper.JS_WindowMessage_Post(wdl, "WM_KEYDOWN", 0x0056, 0, 0, 0) -- V key
 reaper.JS_WindowMessage_Post(wdl, "WM_KEYUP", 0x0056, 0, 0, 0)
end

It is crazy! It works! :O ... I don't see why it should, but it works!
__________________
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 12-23-2018, 08:18 AM   #163
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

JulianSader, thank you again for the implementation of the "Mixer Window visibility improvement"
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 12-23-2018, 03:02 PM   #164
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 508
Default

Would it be possible using this API to implement Ctrl+F on the Media Explorer to set the cursor in the search field?
reapero is offline   Reply With Quote
Old 12-23-2018, 03:38 PM   #165
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by reapero View Post
Would it be possible using this API to implement Ctrl+F on the Media Explorer to set the cursor in the search field?
I see an edit box on the top-right of the explorer window, is that the search box? You should be able to set focus on it like this,..

Code:
local hWnd = reaper.JS_Window_Find("Media Explorer", true)
if hWnd == nil then return end  

local search = reaper.JS_Window_FindChildByID(hWnd, 1015)
if search == nil then return end  

reaper.JS_Window_SetFocus(search)
Edgemeal is offline   Reply With Quote
Old 12-23-2018, 09:37 PM   #166
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,093
Default

^^ Where / how do you get the 1015 for the search box ID?
(or IDs of child windows in general for that matter)
nofish is offline   Reply With Quote
Old 12-23-2018, 11:38 PM   #167
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by nofish View Post
^^ Where / how do you get the 1015 for the search box ID?
(or IDs of child windows in general for that matter)
MS SPY++ (shown below) or similar apps that can display the Control ID.



I made a simple Windows app for top-level windows too.

Last edited by Edgemeal; 01-24-2019 at 07:58 AM. Reason: Updated / Add MS SPY++ GIF
Edgemeal is offline   Reply With Quote
Old 12-24-2018, 02:15 AM   #168
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 508
Default

Quote:
Originally Posted by Edgemeal View Post
I see an edit box on the top-right of the explorer window, is that the search box? You should be able to set focus on it like this,..

Code:
local hWnd = reaper.JS_Window_Find("Media Explorer", true)
if hWnd == nil then return end  

local search = reaper.JS_Window_FindChildByID(hWnd, 1015)
if search == nil then return end  

reaper.JS_Window_SetFocus(search)
Awesome! Thanks!
reapero is offline   Reply With Quote
Old 12-24-2018, 06:17 AM   #169
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,093
Default

Quote:
Originally Posted by Edgemeal View Post
MS SPY++ or similar apps.
I made this quick little app for Windows too,..
https://stash.reaper.fm/v/35034/Get%...er%20Mouse.zip
Thanks (for your app also).
nofish is offline   Reply With Quote
Old 12-24-2018, 10:22 AM   #170
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Quote:
Originally Posted by Edgemeal View Post
v0.962 by juliansader – December 21 2018
* New functions: Browse for files and folders.
* New functions: Various ListView.
* New function: FindChildByID.
* Changed functions: Functions that previously stored strings in ExtStates, now return the strings directly.
* Requirements: On Windows OS, C++ redistributable not required anymore.
* Requirements: REAPER v5.965 or later.
That's nice
Finally I can use the dialogs for selection/saving of folders and multiple files. Fantastic

By the way, how stable from an API-call-perspective would you describe your plugin? Do you plan to make some more extensive changes to some functions, like the ones where you changed from returning into an extstate to directly into a string or do you consider this mostly done at this point? I would love to add some functions to my API that make heavy use of your plugin, but need I some stability in the parameters and retvals to do that.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 12-24-2018 at 10:31 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-27-2018, 01:17 PM   #171
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
By the way, how stable from an API-call-perspective would you describe your plugin? Do you plan to make some more extensive changes to some functions, like the ones where you changed from returning into an extstate to directly into a string or do you consider this mostly done at this point? I would love to add some functions to my API that make heavy use of your plugin, but need I some stability in the parameters and retvals to do that.
I do not foresee any further major changes, since the extstate workaround was the only element of the interface that I was unhappy with.
juliansader is offline   Reply With Quote
Old 12-31-2018, 11:22 PM   #172
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Any of you wizards got a clue how to approach this with js_ReaScriptAPI?
Any idea how to resize dockers through scripts?
Breeder is offline   Reply With Quote
Old 01-01-2019, 09:14 PM   #173
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
Default

This API is enabling some really cool stuff. Thanks Julian!

Is there a way to get and set the pin state of a given hwnd?
tack is offline   Reply With Quote
Old 01-05-2019, 11:06 AM   #174
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by tack View Post
This API is enabling some really cool stuff. Thanks Julian!

Is there a way to get and set the pin state of a given hwnd?
If you mean the topmost pins REAPER adds to most windows? then, If there is I couldn't do it, all I could seem to do was close, hide or move them.

Last edited by Edgemeal; 01-05-2019 at 02:27 PM.
Edgemeal is offline   Reply With Quote
Old 01-05-2019, 02:45 PM   #175
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,093
Default

https://www.extremraym.com/cloud/rea...tachTopmostPin ?

(seems there's missing a function to remove it though)
nofish is offline   Reply With Quote
Old 01-05-2019, 02:55 PM   #176
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
Default

Quote:
Originally Posted by nofish View Post
https://www.extremraym.com/cloud/rea...tachTopmostPin ?

(seems there's missing a function to remove it though)
That function is to add a pin widget to a window that doesn't normally have one (e.g. an undocked reascript), not to get/set the pin state of a window (whether one that that normally has it like a floating FX window or one to which a pin was added via JS_Window_AttachTopmostPin)
tack is offline   Reply With Quote
Old 01-05-2019, 03:09 PM   #177
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,093
Default

Ah yes, misunderstood, sorry.
nofish is offline   Reply With Quote
Old 01-05-2019, 03:27 PM   #178
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by nofish View Post
https://www.extremraym.com/cloud/rea...tachTopmostPin ?

(seems there's missing a function to remove it though)
It's a bit of a workaround, but the button creates its own HWND, so you can remove it with JS_Window_Destroy.


Quote:
Originally Posted by tack View Post
Is there a way to get and set the pin state of a given hwnd?
Not that I know of, unfortunately.

Last edited by juliansader; 01-05-2019 at 03:33 PM.
juliansader is offline   Reply With Quote
Old 01-05-2019, 04:28 PM   #179
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,450
Default

Quote:
Originally Posted by juliansader View Post
Quote:
Originally Posted by tack View Post
Is there a way to get and set the pin state of a given hwnd?
Not that I know of, unfortunately.
Yeah.. I tried this method but it does not work:

Code:
local w = reaper.JS_Window_Find( "FX: Track 1", true )
if w then
  local ok, left, top, right = reaper.JS_Window_GetRect( w )
  if ok then
    local button = reaper.JS_Window_FromPoint( right-34, top+11 )
    local _, leftX, topY = reaper.JS_Window_GetRect(button)
    reaper.JS_Mouse_SetPosition( leftX+8, topY+8 ) -- just to check visually the point
    reaper.JS_WindowMessage_Post(button, "WM_LBUTTONDOWN", 0x0001, 0, leftX+8, topY+8)
    reaper.JS_WindowMessage_Post(button, "WM_LBUTTONUP", 0x0000, 0, leftX+8, topY+8)
  end
end
__________________
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 01-05-2019, 05:00 PM   #180
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by amagalma View Post
Yeah.. I tried this method but it does not work:
If you're trying to click the pin to change its state the old mouse_event function works, but its not in this API, I did it from windows app.

BTW, to click a button/checkbox just send a bm_click message directly to the control,..
Code:
-- Send button click message, aka "BM_CLICK".
reaper.JS_WindowMessage_Send(hWnd, "0x00F5", 0, 0, 0, 0)
But those pins don't support that message either.

Last edited by Edgemeal; 01-05-2019 at 05:52 PM.
Edgemeal is offline   Reply With Quote
Old 01-06-2019, 11:50 AM   #181
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,450
Default

Thanks! BM_CLICK requires the mouse cursor to be positioned at the position to be clicked. In my previous snippet of code I used JS_Mouse_SetPosition, just to assert visually that I was going to post the WM_LBUTTON messages at the correct position.
__________________
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 01-06-2019, 12:17 PM   #182
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by amagalma View Post
Thanks! BM_CLICK requires the mouse cursor to be positioned at the position to be clicked. .
No it doesn't, I use it all the time in Windows, no mouse BS. Used that code to click a button on FX, and worked.

--- Click "+" button on 'FX:' window..
Code:
local hwnd = reaper.JS_Window_Find("FX: Track ", false)
local contanier = reaper.JS_Window_FindChildByID(hwnd, 0)
local control = reaper.JS_Window_FindChildByID(contanier, 1014) -- "+" button
reaper.JS_WindowMessage_Send(control, "0x00F5", 0, 0, 0, 0)
Target may need to be a button class, though I've sent it to other controls and it worked( in Windows apps), but those REAPER pins are not buttons ??? Or just don't support these messages?

Edit According to MSDN for BM_CLICK ,
causes the button to receive the WM_LBUTTONDOWN and WM_LBUTTONUP messages,

But when I tried send those messages to a button (using this API) it doesn't click the button, but sending a BM_CLICK message does.
EDIT Well I take that back, this does work similar to BM_CLICK, I must of had something else wrong before.

Code:
function JS_LMouseDownUp(hWnd)
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONDOWN", 1, 0, 0, 0)
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONUP", 0, 0, 0, 0)
end

Last edited by Edgemeal; 01-06-2019 at 12:49 PM. Reason: Add BM_CLICK example
Edgemeal is offline   Reply With Quote
Old 01-06-2019, 12:48 PM   #183
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,450
Default

I see! Thank you for the info!
__________________
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 01-16-2019, 08:33 AM   #184
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

@Juliansader

What kind of limitations are currently, when thinking about cross-platform-developing with the JS-plugin?
I remember, that some window-stuff is possible only on Windows(transparent windows, AFAIK?) and that not all windows have a HWND on all platforms.

So, do you already know, which windows don't have a HWND?
I tested and found, ReaScript-console is missing a HWND on Mac.

And what else is only possible on windows?


And a small FeatureRequest: JS_Dialog_BrowseForSaveFile, in the docs, it is not mentioned, how I can set the parameter extensionList. I tried several variations like "*.gif" or "*.gif|*.jpg" but it didn't work. The latter even added some weird additional entry into the extension-dropdownlist of the dialog.
Tested on Windows 7 with Reaper 5.965, SWS 2.7.9 and your plugin 0.962.
Could you add some hints for using that parameter?
__________________
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 01-16-2019, 08:35 AM   #185
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Oh, anyone interested in a code-snippet for getting the HWND of an opened gfx.init-window in Lua?

I've built me some code that does that for my API and will be released in the next version, but maybe, some of you need something like that right now...
__________________
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 01-16-2019, 09:05 AM   #186
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

Quote:
Originally Posted by mespotine View Post
how I can set the parameter extensionList. I tried several variations like "*.gif" or "*.gif|*.jpg" but it didn't work. The latter even added some weird additional entry into the extension-dropdownlist of the dialog.
Tested on Windows 7 with Reaper 5.965, SWS 2.7.9 and your plugin 0.962.
Could you add some hints for using that parameter?
The default (I checked the source code) extension format is like this

Code:
"All files (*.*)\0*.*\0\0"
if that helps?
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website
lb0 is offline   Reply With Quote
Old 01-16-2019, 10:14 AM   #187
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
What kind of limitations are currently, when thinking about cross-platform-developing with the JS-plugin?
I'm not quite sure, unfortunately, since I can't test on MacOS.
Please let me know if you find anything else that doesn't work on all three platforms!

AFAIK, GDI isn't properly implemented on Linux. (I should probably submit a bug report to Justin in the WDL subforum.)


Quote:
Originally Posted by mespotine View Post
I remember, that some window-stuff is possible only on Windows(transparent windows, AFAIK?)
Making the entire window transparent should work on all platforms, but making a single color transparent is Windows-only.


Quote:
Originally Posted by mespotine View Post
and that not all windows have a HWND on all platforms.

So, do you already know, which windows don't have a HWND?
I tested and found, ReaScript-console is missing a HWND on Mac.
I am surprised. I expected that all REAPER windows would have HWNDs.

What code did you use to get the console's HWND?



Quote:
Originally Posted by mespotine View Post
And a small FeatureRequest: JS_Dialog_BrowseForSaveFile, in the docs, it is not mentioned, how I can set the parameter extensionList. I tried several variations like "*.gif" or "*.gif|*.jpg" but it didn't work. The latter even added some weird additional entry into the extension-dropdownlist of the dialog.
Tested on Windows 7 with Reaper 5.965, SWS 2.7.9 and your plugin 0.962.
Could you add some hints for using that parameter?
I will add info to the docs:

extensionList is a string containing pairs of \0-terminated substrings. The last substring must be terminated by two \0 characters.

Each pair defines one filter pattern: The first substring in each pair describes the filter in user-readable form (for example, "Lua script files (*.lua)") and will be displayed in the dialog box.

The second substring specifies the filter that the operating system must use to search for the files (for example, "*.txt"). To specify multiple extensions for a single display string, use a semicolon to separate the patterns (for example, "*.lua;*.eel").

The filter substring can be a combination of valid file name characters (excluding spaces) and the asterisk (*) wildcard character. In Windows, an extension without * is valid (for example ".txt\0") but other platforms may require the full pattern with wildcard ("*.txt\0").

An example of a extensionList string:
"ReaScript files\0*.lua;*.eel\0Lua files (.lua)\0*.lua\0EEL files (.eel)\0*.eel\0\0".

If the extensionList string is empty, it will display the default "All files (*.*)" filter.


P.S.: Microsoft's online documentation for the corresponding C++ functions is probably the best way to find out how to use the API functions.

Last edited by juliansader; 01-16-2019 at 10:37 AM.
juliansader is offline   Reply With Quote
Old 01-18-2019, 09:09 AM   #188
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Quote:
Originally Posted by juliansader View Post
Making the entire window transparent should work on all platforms, but making a single color transparent is Windows-only.
So that means, I can make a window transparent, but the stuff I draw into that window will also be transparent?



Quote:
I am surprised. I expected that all REAPER windows would have HWNDs.

What code did you use to get the console's HWND?
I wrote into my API a function to close the ReaConsole-window:

Code:
function ultraschall.CloseReaConsole()
  local retval,Adr=reaper.JS_Window_ListFind("ReaScript console output", true)

  if retval>1 then ultraschall.AddErrorMessage("CloseReaConsole", "", "Multiple windows are open, that are named \"ReaScript console output\". Can't find the right one, sorry.", -1) return false end
  if retval==0 then ultraschall.AddErrorMessage("CloseReaConsole", "", "ReaConsole-window not opened", -2) return false end
  local B=reaper.JS_Window_HandleFromAddress(Adr)
  reaper.JS_Window_Destroy(B)
  return true
end
It works only on Windows, but not on Mac, as if it can't find the HWND.
I haven't checked yet, if there's a way to get the HWND in a different way or if the ReaConsole has a slightly different title on Mac.
I'm currently digging through the way, HWNDs work in Reaper and which HWNDs are provided and which are not.


Quote:
I will add info to the docs:

extensionList is a string containing pairs of \0-terminated substrings. The last substring must be terminated by two \0 characters.
...
Thank you



BTW: under which license is your plugin? SWS is MIT-licensed and it would be great, if that would be the case for your plugin too.
I'm asking, as we would love to use your plugin in our distribution of Ultraschall and don't want to run into licensing conflicts.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 01-18-2019 at 09:51 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-18-2019, 09:13 AM   #189
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

For whom it may concern, I wrote a function, that opens the gfx.init-window AND returns its HWND. Use that, if you need to work with the HWND of a gfx-window.
It will be part of the next update of my Ultraschall-API.
The parameters are the exact same way as gfx.init.

Requires(of course) the JS-plugin installed and works on Mac and Windows (linux untested yet).

Code:
ultraschall={}

function ultraschall.GFX_Init(...)
  local parms={...}
  local temp=parms[1]

  -- check, if the given windowtitle is a valid one, 
  -- if that's not the case, use "" as name
  if temp==nil or type(temp)~="string" then temp="" end  
  if type(parms[1])~="string" then parms[1]="" 
  end
  
  -- check for a window-name not being used yet, which is 
  -- windowtitleX, where X is a number
  local freeslot=0
  for i=0, 65555 do
    if reaper.JS_Window_Find(parms[1]..i, true)==nil then freeslot=i break end
  end
  -- use that found, unused windowtitle as temporary windowtitle
  parms[1]=parms[1]..freeslot
  
  -- open window  
  local retval=gfx.init(table.unpack(parms))
  
  -- find the window with the temporary windowtitle and get its HWND
  local HWND=reaper.JS_Window_Find(parms[1], true)
  
  -- rename it to the original title
  if HWND~=nil then reaper.JS_Window_SetTitle(HWND, temp) end
  ultraschall.GFX_WindowHWND=HWND
  return retval, HWND
end
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 01-18-2019 at 09:48 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-18-2019, 11:44 AM   #190
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
So that means, I can make a window transparent, but the stuff I draw into that window will also be transparent?
I haven't tried this on macOS, but I expect that the entire window and everything in it would become transparent.


Quote:
Originally Posted by mespotine View Post
It works only on Windows, but not on Mac, as if it can't find the HWND.
I haven't checked yet, if there's a way to get the HWND in a different way or if the ReaConsole has a slightly different title on Mac.
When finding windows by title, it is always safer to use JS_Localize to get the localized title text. I'm not sure if this will solve the problem, but it is worth a try.

Perhaps do a Window_ListAllTop and check the titles of the all the windows in the list?


Quote:
Originally Posted by mespotine View Post
BTW: under which license is your plugin? SWS is MIT-licensed and it would be great, if that would be the case for your plugin too.
I'm asking, as we would love to use your plugin in our distribution of Ultraschall and don't want to run into licensing conflicts.
I haven't really thought about licensing terms or what the different licenses entail, but everyone is very welcome to use this API in any of their scripts (and I would be glad if they do!).
juliansader is offline   Reply With Quote
Old 01-18-2019, 11:46 AM   #191
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Please correct me if this is wrong.
Scripts run on the single GUI thread correct? So if a script (no defer loops) opens a window the script waits until that window finishes loading and then the script continues onto the next line of code right? Which means I can get the handle of a window I just opened from the script simply using GetForegroundWindow ?

Example,..
Code:
local title, x, y, w, h = "Adjust Envelopes", 200, 100, 300, 50
gfx.init(title, x, y, 0, w, h)
gfx.x, gfx.y = 12, 40
gfx.drawstr("Press Esc when done!")
gfx.update()

hwnd=reaper.JS_Window_GetForeground()
reaper.ShowConsoleMsg(tostring(hwnd) .. "\n")
I was actually surprised opening plugins from scripts the code can find the handle of the window right after opening them, so it must be single threaded, for example in my VS apps I have to actually wait/sleep to give the other window time to load and draw,etc before I can get its window handle.

Last edited by Edgemeal; 01-18-2019 at 12:31 PM.
Edgemeal is offline   Reply With Quote
Old 01-18-2019, 11:59 AM   #192
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

As far as I understood, you can access all windows opened in Windows at least, not only Reaper-windows.

So you can't be sure of what the user does. Opening a gfx-window doesn't necessarily mean, the foreground window is that gfx-window, but can be a texteditor or such.

My code circumvents that. I might add other safety-mechanisms as well to make wrong hwnds even more unlikely.


@juliansader

Quote:
When finding windows by title, it is always safer to use JS_Localize to get the localized title text. I'm not sure if this will solve the problem, but it is worth a try.

Perhaps do a Window_ListAllTop and check the titles of the all the windows in the list?
Good to know. I'm also trying to find a way to get all HWNDs for all Reaper-windows without accidentally getting the wrong one due same-naming and such. So this hopefully helps.
__________________
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 01-18-2019, 12:09 PM   #193
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by mespotine View Post
As far as I understood, you can access all windows opened in Windows at least, not only Reaper-windows.

So you can't be sure of what the user does. Opening a gfx-window doesn't necessarily mean, the foreground window is that gfx-window, but can be a texteditor or such.
I understand that, was bad example, just really wanted to know if scripts and calling functions from extensions are all running on the same thread.
Edgemeal is offline   Reply With Quote
Old 01-18-2019, 02:40 PM   #194
tparker24
Human being with feelings
 
Join Date: Dec 2017
Posts: 83
Default Can't get started

I wanted to try ReaScriptAPI, but am having problems just getting started:

1) I couldn't find it on ReaPack.

2) I saw the files on GitHub, but don't know how/where to install them.

3) I want to use this from python, but couldn't find the normal .py interface file.


Can you help me out?
tparker24 is offline   Reply With Quote
Old 01-19-2019, 09:50 AM   #195
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,093
Default

Quote:
Originally Posted by tparker24 View Post
1) I couldn't find it on ReaPack.
It should be listed in ReaPack as 'js_ReaScriptAPI: API functions for ReaScripts' and the repository where it's hosted (ReaTeam/Extensions) should be enabled by default in ReaPack afaik.
If you don't see it, maybe try 'Synchronize packages' ?
nofish is offline   Reply With Quote
Old 01-19-2019, 10:15 AM   #196
tparker24
Human being with feelings
 
Join Date: Dec 2017
Posts: 83
Default

Quote:
Originally Posted by nofish View Post
It should be listed in ReaPack as 'js_ReaScriptAPI: API functions for ReaScripts' and the repository where it's hosted (ReaTeam/Extensions) should be enabled by default in ReaPack afaik.
If you don't see it, maybe try 'Synchronize packages' ?
Still no luck.

I searched for "js_reascript" and then for "js_rea", but got no results. ("js_re" did show a bunch, but nothing with reascript).

My settings are "Display: All" and "All Packages". I didn't see "Synchronize packages", but I did try "Refresh repositories", without any success.
tparker24 is offline   Reply With Quote
Old 01-19-2019, 10:24 AM   #197
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by tparker24 View Post
I searched for "js_reascript" and then for "js_rea", but got no results. ("js_re" did show a bunch, but nothing with reascript).
Manage Repositories > "ReaTeam Extensions" is enabled? > Sync again.
Edgemeal is offline   Reply With Quote
Old 01-19-2019, 10:32 AM   #198
tparker24
Human being with feelings
 
Join Date: Dec 2017
Posts: 83
Default

Quote:
Originally Posted by Edgemeal View Post
Manage Repositories > "ReaTeam Extensions" is enabled? > Sync again.
Yes, they're all enabled. Did yet another "Refresh repositories", but still no luck.

I vaguely remember something about it being removed from Reapack ... could you perhaps give it a try?
tparker24 is offline   Reply With Quote
Old 01-19-2019, 10:46 AM   #199
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,903
Default

Quote:
Originally Posted by tparker24 View Post
Yes, they're all enabled. Did yet another "Refresh repositories", but still no luck.

I vaguely remember something about it being removed from Reapack ... could you perhaps give it a try?
Ya still there, v0.962. I have no clue what the problem could be, maybe exit reaper, delete the reapack cache/files, and re-setup?
Edgemeal is offline   Reply With Quote
Old 01-19-2019, 11:08 AM   #200
tparker24
Human being with feelings
 
Join Date: Dec 2017
Posts: 83
Default

Quote:
Originally Posted by Edgemeal View Post
Ya still there, v0.962. I have no clue what the problem could be, maybe exit reaper, delete the reapack cache/files, and re-setup?
Deleting the Reapack directory and starting over didn't really help.

FYI, my Reaper version is v5.965/x64.
tparker24 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 01:55 AM.


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