Old 11-19-2019, 09:40 AM   #801
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Yes, the functions seem to be limited to windows opened by Reaper/WDL/Swell-applications.

Had the same problem when trying to make autoscreenrecording using LiceCap. I can access LiceCap itself to hit the recordbutton, but not the buttons of the save-file-dialog, which seems to be an os-based-dialog.

Though you can find the windows and their hwnd without a problem...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635

Last edited by mespotine; 11-19-2019 at 09:49 AM.
mespotine is offline   Reply With Quote
Old 11-19-2019, 11:37 AM   #802
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Quote:
Originally Posted by Edgemeal View Post
Is JS_Window_Destroy() limited to REAPER child windows only or something? Was trying to close a Windows notepad in Win10(1909)...
Yes, it is limited to REAPER windows. According to the MS documentation:
Quote:
A thread cannot use DestroyWindow to destroy a window created by a different thread.
juliansader is offline   Reply With Quote
Old 11-19-2019, 11:44 AM   #803
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,516
Default

Quote:
Originally Posted by juliansader View Post
Yes, it is limited to REAPER windows. According to the MS documentation:
Thanks!
Edgemeal is offline   Reply With Quote
Old 11-19-2019, 11:47 AM   #804
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 3,029
Default

I have some issues with setting the z-order of a non-Reaper window.

I noticed: when changing the Z-order of a window and ALT-Tabbing right afterwards, there are some issues. As if the other windows wouldn't know which z-order they now have.
That means, the title bar is activated, but when using helper programs like Logitech's keyboard software, Stream Deck or iCue from Corsair (they change the shortcuts based on the active window name), these applications show the shortcuts from a different application but not the one where the title bar is activated.

Is it necessary to update all windows, after having changed the z-order?
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 11-21-2019, 10:58 AM   #805
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 48
Default Help using JS_ReascriptAPI

Hi there.
I would like to use some of the functions like JS_Dialog_BrowseForFolder with Python.
I installed the package from Reapack and restarted Reaper. The functions are listed in the Reascript documentation generated by my current Reaper setup.
As far as I understand I only have to call it as it is, without the usual RPR_ prefix.

So I would simply call:

Code:
( retval, caption, initialFolder, folderOutNeedBig, folderOutNeedBig_sz ) = JS_Dialog_BrowseForFolder("hop", "./C", "", "" )
This gives the following error:

---
Script execution error

Traceback (most recent call last):
File "testFolderSelect.py", line 4, in <module>
( retval, caption, initialFolder, folderOutNeedBig, folderOutNeedBig_sz ) = JS_Dialog_BrowseForFolder("hop", "./C", "", "" )
NameError: name 'JS_Dialog_BrowseForFolder' is not defined
---

What am I missing?

C
Cedrik0s is offline   Reply With Quote
Old 11-21-2019, 11:03 AM   #806
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,992
Default

Quote:
Originally Posted by Cedrik0s View Post
As far as I understand I only have to call it as it is, without the usual RPR_ prefix.
Try with the RPR_ prefix. (It could be possible that the JS extension has not been tested to work with Python, though.)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 11-21-2019, 11:05 AM   #807
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 48
Default

Quote:
Originally Posted by Xenakios View Post
Try with the RPR_ prefix.
Thanks for your answer Xenakios.

I did with RPR_JS_, RPR_, JS_ ...
Always the same error.
Cedrik0s is offline   Reply With Quote
Old 11-21-2019, 11:23 AM   #808
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Quote:
Originally Posted by Xenakios View Post
Try with the RPR_ prefix. (It could be possible that the JS extension has not been tested to work with Python, though.)
I haven't yet used Python with REAPER, and unfortunately have no idea whether the extension is compatible with Python.
juliansader is offline   Reply With Quote
Old 11-21-2019, 12:24 PM   #809
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Afaik, there's a file for that, which needs to be added and includes all functions-declarations.
There's already one included with SWS and Reaper:

reaper_python.py
sws_python.py
sws_python64.py

so I think, one like that would be needed for JS-extension too.
Somewhere in this thread, someone made such a file, but it's for an older version and I don't remember, which post it had...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-21-2019, 12:51 PM   #810
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,196
Default

Quote:
Originally Posted by mespotine View Post
Afaik, there's a file for that, which needs to be added and includes all functions-declarations.
There's already one included with SWS and Reaper:

reaper_python.py
sws_python.py
sws_python64.py

so I think, one like that would be needed for JS-extension too.
Somewhere in this thread, someone made such a file, but it's for an older version and I don't remember, which post it had...
This one is the latest I think (at least I haven't spotted any newer ones here):
https://stash.reaper.fm/v/36404/js_ReaScriptAPI.py

@juliansader
If you consider providing the Python function wrappers in the future, as mentioned in the related post they are quite straightforward to generate using the Perl scripts SWS is also using to generate them.

edit:
@Cedrik0s
Where to put that file and a simple Python test script can also be found in above post.

Last edited by nofish; 11-21-2019 at 03:00 PM.
nofish is offline   Reply With Quote
Old 11-21-2019, 05:17 PM   #811
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 48
Default

Since the JS functions are listed in the generated documentation, I took it for granted it was supported for python.

Anyway it is great news to see it somehow is, and I will check the other thread as soon as I can.

Thank you all!

PS : if there is any other way to get basic select file/folder dialog from a python reascript, I'd be glad to know!
Cedrik0s is offline   Reply With Quote
Old 11-21-2019, 05:25 PM   #812
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

For file, you can use:

https://mespotin.uber.space/Ultrasch...ileNameForRead

It only allows selecting one file and you cannot use it for selecting non-existant files(which is essential for file-save).
For folder, nothing of that exists.
But, if you only need that for your own scripts, you could use GetUserFileNameForRead, select a file and extract the path from the selected file. Would be a hack, though, but could work, unless the folder is empty.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-24-2019, 04:23 AM   #813
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 48
Default

Thanks mespotine.
GetUserFileNameForRead could be a solution for single file selection indeed.
Btw, your documentation with comments (i.e. documention ) is nice!

I have yet to try the js_ReaScriptAPI.py.
Will do.

Thanks all.

C
Cedrik0s is offline   Reply With Quote
Old 12-05-2019, 04:21 AM   #814
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 3,204
Default

Hi Julian,

I'm trying to overlay part of a JSFX GUI over one of my script GUIs. I've currently tried a lot of things and none are perfect.

Most success has been had by creating a an 'overlay' window and GDI blitting between the JSFX window and the new overlay window and keeping that on top of my script gui using TOPMOST. But this isn't ideal as it sits over other windows that I don't want it to sit over - I simply want it to sit above just my script GUI window and no others. I've tried writing code to release the TOPMOST flag of the created window when other windows have the focus - but it's clunky and doesn't work perfectly - depending on what window has focus - the overlay window sometimes falls behind the script GUI - especially when it's docked.

I've tried the Composite LICE bitmap method - but being on WindowsOS - this is headache inducing with the amount of flicker.

So I've had another idea and I don't know if it is feasible - but you might. Is it possible to set the overlay window as a child of my script GUI window using something like SetParent Windows API? I don't know whether this would work as it may depend on the window process ownership of the window. Any thoughts? Obviously the SetParent API isn't available in your API - and I wondered if there was any reason? If the overlay window was able to be made a child window - could it somehow be hooked into keeping it's relative location with the parent script GUI window?

Can you think of any other way of keeping the overlay window just above my script GUI without using TOPMOST which might work more consistently?

Cheers,
L.

Overlay window :



I also created a LICE gif of the flickery Composite method - but interestingly the GIF doesn't show the flicker (possibly framerate or LICE related).
__________________
Projects - Reascripts - Lua:
LBX Stripper | LBX Chaos Engine | LBX Floating FX Positioner | LBX SRD Smart Knobs
Donate via Paypal
lb0 is offline   Reply With Quote
Old 12-07-2019, 03:35 PM   #815
JerContact
Human being with feelings
 
Join Date: Feb 2017
Posts: 41
Default JS api calls into other C++ extensions?

@Julian

Julian, your API is awesome!!! I use it everyday. I was wondering, do you have any thoughts on letting us add your API to other c++ extensions? I have a reaper extension right now that I'm trying to figure out how to take away the reaconsole window. I know ultraschall does it, but it would be in lua and not through c++. I see he is using your JS window functions to get this to work, but I can't call your functions in c++ without somehow adding your library somewhere. Are you thinking of exposing an API list directly from c++ sometime?

Thanks for all the magic work!
JerContact is offline   Reply With Quote
Old 12-07-2019, 03:41 PM   #816
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,887
Default

You can just use the Win32 API directly in C++. (You can use extension-provided API functions too, as long as you import them after they were registered.)

Last edited by cfillion; 12-07-2019 at 04:23 PM.
cfillion is online now   Reply With Quote
Old 12-07-2019, 03:56 PM   #817
JerContact
Human being with feelings
 
Join Date: Feb 2017
Posts: 41
Default

@Julian

Nevermind! I found Julian's github repository!

Yeah, I just wanted to see how Julian was going about getting the window information as a starting point!
JerContact is offline   Reply With Quote
Old 12-08-2019, 12:14 PM   #818
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Quote:
Originally Posted by lb0 View Post
So I've had another idea and I don't know if it is feasible - but you might. Is it possible to set the overlay window as a child of my script GUI window using something like SetParent Windows API? I don't know whether this would work as it may depend on the window process ownership of the window. Any thoughts? Obviously the SetParent API isn't available in your API - and I wondered if there was any reason? If the overlay window was able to be made a child window - could it somehow be hooked into keeping it's relative location with the parent script GUI window?

Can you think of any other way of keeping the overlay window just above my script GUI without using TOPMOST which might work more consistently
Unfortunately I don't know if the SetParent approach will work, but it is worth a try! I will add SetParent to the next update of the extension.
juliansader is offline   Reply With Quote
Old 12-09-2019, 08:11 AM   #819
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 249
Default

Peeps,

Wouldnt it be nice if we could zoom in/out on different things with the same mousewheel shortcut inside the midi editor? So if your mouse cursor is on the regular midi view you zoom horizontally as usual, but if you hover over the piano keys on the left you do vertical zooming with the same mousewheel+key combination, if you are on a certain MIDI lane you just increase/decrease the height of that CC lane only, etc.

I was trying to find the different windows with Spy++ but all the left frame (midipianoview) of the midi editor is the same window (so, there´s no difference between the piano notes and the velocity/CC lanes). Also looks like the central part(midiview) is a big block as well - no difference between the piano and the cc/vel editing area.

So is that an unfeasible task with Reascript and this extension?
reapero is offline   Reply With Quote
Old 12-09-2019, 10:29 AM   #820
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

This is indeed how I have set up my own mousewheel in the MIDI editor.

However, you don't need the js_ReaScriptAPI extension -- only SWS: Use BR_GetMouseCursorContext() and BR_GetMouseCursorContext_MIDI() to get the part of the MIDI editor under the mouse, and then call the appropriate action from the Actions list with MIDIEditor_OnCommand.
juliansader is offline   Reply With Quote
Old 12-09-2019, 03:33 PM   #821
Cedrik0s
Human being with feelings
 
Join Date: Oct 2014
Posts: 48
Default

Quote:
Originally Posted by Cedrik0s View Post
I have yet to try the js_ReaScriptAPI.py.
I finally tried and it just works!

Thanks everyone!

C
Cedrik0s is offline   Reply With Quote
Old 12-09-2019, 04:58 PM   #822
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 3,204
Default

Quote:
Originally Posted by juliansader View Post
Unfortunately I don't know if the SetParent approach will work, but it is worth a try! I will add SetParent to the next update of the extension.
Oh wow - thanks!

I have my doubts as to whether it will work without further involvement with the OSs API - but if it's not too much hassle for you to add the SetParent option - then I'll give it a try.

It's a real shame the elegant Composite bitmap solution doesn't work for Windows (in my use case) - as if it wasn't for the flicker - it would be perfect!

Another wish would be for LICE bitmaps to be compatible with Reascripts native bitmaps (ie. blittable into one of the 1024 script bitmaps) - that would also solve the problem - but knowing nothing about the two formats - I guess they're not easily interchangeable (although how different can bitmap formats be assuming they are not compressed in any way and use the same bit depth?).

Anyway - I look forward to trying SetParent... Thanks again.
__________________
Projects - Reascripts - Lua:
LBX Stripper | LBX Chaos Engine | LBX Floating FX Positioner | LBX SRD Smart Knobs
Donate via Paypal
lb0 is offline   Reply With Quote
Old Today, 05:02 AM   #823
AndrewFalcon
Human being with feelings
 
AndrewFalcon's Avatar
 
Join Date: Dec 2018
Posts: 17
Default

Dear friends! Please tell me. How to send ctrl+alt+left mouse click to specified window.I`ve tried this but only click is sent (
Code:
x,y = reaper.GetMousePosition()
frompoint = reaper.JS_Window_FromPoint(x,y)
trw=frompoint
x_trw, y_trw = reaper.JS_Window_ScreenToClient( trw, x, y )

  
 reaper.JS_Window_SetFocus(trw)
 reaper.JS_WindowMessage_Post(trw, "WM_KEYDOWN", 17, 0, 0, 0)
 reaper.JS_WindowMessage_Post(trw, "WM_KEYDOWN", 18, 0, 0, 0)
 reaper.JS_WindowMessage_Post(trw , "WM_LBUTTONDOWN", 8, 0, x_trw, y_trw)
 reaper.JS_WindowMessage_Post(trw , "WM_LBUTTONUP", 8, 0, x_trw, y_trw)
AndrewFalcon is offline   Reply With Quote
Old Today, 11:32 AM   #824
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,108
Default

Is there a way to know on a text field at which character position the TEXT CARRET "ⵊ" cursor is ?


Thx!
X-Raym is offline   Reply With Quote
Old Today, 01:37 PM   #825
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,516
Default

Quote:
Originally Posted by X-Raym View Post
Is there a way to know on a text field at which character position the TEXT CARRET "ⵊ" cursor is ?


Thx!
Maybe Try EM_GETSEL, something like this, using search box in explorer as test....

Code:
EM_GETSEL = "0x00B0"
local explorer = reaper.OpenMediaExplorer("", false)
if explorer then
  local search = reaper.JS_Window_FindChildByID(explorer, 1015) 
  local retval = reaper.JS_WindowMessage_Send(search, EM_GETSEL, 0,0,0,0)
  local caret_pos = retval & 0xFFFF 
  msg(caret_pos)
end
Edgemeal is offline   Reply With Quote
Old Today, 06:02 PM   #826
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,108
Default

@edgemeal
Many thanks !!
What do you think of that ? :P




(edit: just noticed SWS window dont refresh but I found a way)

(subtitle workflow)


Note to get the SWS notes window I simply use


Code:
local sws_notes_hwnd = reaper.JS_Window_Find( "Notes", true )
if sws_notes_hwnd then
  local sws_notes_edit_hwnd = reaper.JS_Window_FindChildByID(sws_notes_hwnd, 1096)
  if not sws_notes_edit_hwnd then return end

Do you think it is enough or that I should use a more solid solution ?
X-Raym is offline   Reply With Quote
Old Today, 06:45 PM   #827
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,516
Default

Quote:
Originally Posted by X-Raym View Post
Do you think it is enough or that I should use a more solid solution ?
If 'Notes' is never docked then you could use 'reaper.JS_Window_FindTop', which may be hair faster/more efficient, otherwise should be fine.
Edgemeal 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 09:10 PM.


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