Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 09-05-2019, 10:46 AM   #1
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default Get external screen width & heigth via Reascript

Hey guys!

Is there a way to retrieve external screen width & heigth with the API function reaper.my_getViewport?
I would like to move the focused FX either at the center of the main screen or the center of the external screen.

Thank you!
Infrabass is offline   Reply With Quote
Old 09-05-2019, 10:57 AM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

As far as I've been able to tell, my_getviewport can only return the total screen area and not individual monitors; my GUI used to use it to center windows and dual-monitor users kept having the window pop up right in between their screens.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 09-06-2019, 07:39 AM   #3
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Thanks for the reply Lokasenna!
In my case, I have a dual monitor setup and fortunately my_getviewport give me the width & heigth of my main screen only.
So it seems there is no way currently to call the size of a specific external screen.
I'm gonna live with it!
:-)
Cheers!
Infrabass is offline   Reply With Quote
Old 09-06-2019, 08:10 AM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

If you know there are two displays and you have the width of the first display then add 1 to that and pass it to JS_Window_GetViewportFromRect, it should return the bounds of the next display, but if there is only one display it will just return the first display bounds, Tested on Win10,..
Code:
x1 = 1921 -- monitor#1 width+1 (left position of 2nd monitor)
local left, top, right, bottom = reaper.JS_Window_GetViewportFromRect(x1, 0, 1, 1, true)
js_ReaScriptAPI extension

Last edited by Edgemeal; 09-08-2019 at 12:19 PM. Reason: add link
Edgemeal is offline   Reply With Quote
Old 09-06-2019, 10:10 AM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

+1

Note: Requires the JS extension, and not all of the functions in there work on Linux just FYI.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 09-10-2019, 06:35 AM   #6
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Nice!
Will try it today!
Is there a list of the JS functions not working on Linux somewhere Lokasenna?
Infrabass is offline   Reply With Quote
Old 09-10-2019, 06:42 AM   #7
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Nothing comprehensive. Julian has added notes to some of his commands though, so if you search for Linux in the docs you'll get a few hits: https://www.extremraym.com/cloud/reascript-doc/
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 09-10-2019, 06:59 AM   #8
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Thank you!
Infrabass 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 02:12 AM.


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