Old 06-21-2019, 01:24 AM   #601
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,621
Default

Quote:
Originally Posted by _Stevie_ View Post
Nope, the Reaper Mixer window does, though.
Quote:
Originally Posted by tack View Post
I'm in the same boat as Stephan, no pin on that window either.
Ah, so SWS is in the same boat. This is good news in a way, since it means the problem doesn't lie with ReaScriptAPI.


Quote:
Originally Posted by tack View Post
Do you reckon it's an SWS issue?
No, ReaScriptAPI adds the pin directly, without requiring SWS, so it seems to be a REAPER or Windows issue. Both extensions use the same trick to add the pin, namely an undocumented, unofficial feature of REAPER.

I will submit a bug report thread, but since the feature is not officially supported, it may not be high on the devs' priority list.

Are either of you perhaps using an unusual Windows 10 theme, or anything else that might affect window frames, such as WindowBlinds?
juliansader is offline   Reply With Quote
Old 06-21-2019, 02:58 AM   #602
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,453
Default

Using the default Windows 10 theme. No changes or theme hacks.
__________________
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 offline   Reply With Quote
Old 06-29-2019, 09:44 AM   #603
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 106
Default

Hi JS!

Your extension is a thing of beauty, a great contribution to the Reaper community.

Wanna throw an idea past you for plausibility and whether or not you think it would be of value:

I know you have functions that get the mouse cursor's time-position from the arrange, would it be possible to have a function where you could get an item's x/y-coordinates at its upper-left point?

Similarly, I could also see potential value in a function that could get the x coordinate of the project edit cursor.

High regards,

Dafark
Dafarkias is offline   Reply With Quote
Old 06-30-2019, 04:24 PM   #604
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,621
Default

Quote:
Originally Posted by Dafarkias View Post
I know you have functions that get the mouse cursor's time-position from the arrange, would it be possible to have a function where you could get an item's x/y-coordinates at its upper-left point?

Similarly, I could also see potential value in a function that could get the x coordinate of the project edit cursor.
This is actually already possible, using the existing API. For example, to get item position, get the track y position as in this code above, and then get the item position inside the track using GetMediaItemInfo_Value with I_LASTY, I_LASTH, F_FREEMODE_Y and F_FREEMODE_H.
juliansader is offline   Reply With Quote
Old 07-01-2019, 04:11 AM   #605
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 106
Default

Quote:
Originally Posted by juliansader View Post
This is actually already possible, using the existing API. For example, to get item position, get the track y position as in this code above, and then get the item position inside the track using GetMediaItemInfo_Value with I_LASTY, I_LASTH, F_FREEMODE_Y and F_FREEMODE_H.
That is very cool, wow, thank you.

I assume in order to get the edit-cursor's 'x' position one would simply get the x/y position of the arrange view window, and then use arrange view start/end time positions to calculate the edit-cursor's 'x' position?

Sorry to bother you with such a simplistic question, I've just wanted to add features to several scripts that use screen coordinate capabilities, and I think that being able to screen-coordinate the edit-cursor and item positions would really help me in this.

[ADD., 7/1/19]

This seems to work okay:

Code:
function get_EC_x(EC_time_pos)
  
  local x, y = reaper.JS_Window_ClientToScreen(  reaper.JS_Window_Find( "trackview", 1 ), 0, 0 )
  local retval, w, h = reaper.JS_Window_GetClientSize( reaper.JS_Window_Find( "trackview", 1 ) )
  local AV_a, AV_z = reaper.GetSet_ArrangeView2( 0, 0, 0, 0 )
  local AV_w = AV_z - AV_a 
  local AV_w_EC_pos = EC_time_pos - AV_a         
  
  return (math.floor(w/(AV_w/AV_w_EC_pos)) + x)

end

Last edited by Dafarkias; 07-01-2019 at 04:56 AM.
Dafarkias is offline   Reply With Quote
Old 07-01-2019, 09:12 AM   #606
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

Quote:
Originally Posted by juliansader View Post
This is actually already possible, using the existing API. For example, to get item position, get the track y position as in this code above, and then get the item position inside the track using GetMediaItemInfo_Value with I_LASTY, I_LASTH, F_FREEMODE_Y and F_FREEMODE_H.
Oooh...that's nice! Will add that to my Ultraschall-API!

@Dafarkias
Could this help you as well?
https://mespotin.uber.space/Ultrasch...tItemFromPoint
__________________
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 07-01-2019, 12:42 PM   #607
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,621
Default

Quote:
Originally Posted by Dafarkias View Post
I assume in order to get the edit-cursor's 'x' position one would simply get the x/y position of the arrange view window, and then use arrange view start/end time positions to calculate the edit-cursor's 'x' position?
Yep, the code that you posted above should work. Just look out for divide-by-zero errors, and Window_FindChildByID(mainHWND, 1000) is more cross-platform reliable than Window_Find("trackview").

For interest's sake, here is some code that we used in another thread to do the same calculations as you do above:
Code:
trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
rectOK, leftmostArrangeY = reaper.JS_Window_GetRect(trackview)
infoOK, scrollPos, pageSize, min, max, trackPos = reaper.JS_Window_GetScrollInfo(trackview, "HORZ")
cursorTimeFromStart = reaper.GetCursorPositionEx(0) -- Always counted from start of project, ignores "Project start time"
zoom = reaper.GetHZoomLevel() -- returns pixels/second
cursorPixelsFromStart = cursorTimeFromStart*zoom
cursorY = leftmostArrangeY + (cursorPixelsFromStart - scrollPos)
juliansader is offline   Reply With Quote
Old 07-01-2019, 02:40 PM   #608
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 106
Default

Quote:
Originally Posted by mespotine View Post
Always been a fan of your API... I think that's kinda the opposite of what I'm looking for in this regard though.

I'd like a function that gets a specific item's x/y coordinates, whereas it seems the function you referenced gets the item of a specific x/y coordinate.

Quote:
Originally Posted by juliansader View Post
Yep, the code that you posted above should work. Just look out for divide-by-zero errors, and Window_FindChildByID(mainHWND, 1000) is more cross-platform reliable than Window_Find("trackview").
Thanks for the information. I'm interested about what you say regarding divide-by-zero errors... Even when I input EC_time_pos and AV_a both as the value '0' and effectively divide AV_w by '0' I receive no error. Is that commonplace?

Last edited by Dafarkias; 07-01-2019 at 02:46 PM.
Dafarkias is offline   Reply With Quote
Old 07-07-2019, 09:52 AM   #609
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

How can I access dropdown/context-menüs programmatically?

I would love to access the following menupoint:

__________________
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 07-07-2019, 10:13 AM   #610
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 2,224
Default

Anyone? i am trying to use this:
reaper.JS_Window_SetOpacity(w, "ALPHA", 0.5 )
but nothing happens! does this work on OSX (10.9.5) or am i doing something wrong?

docs says:
Code:
boolean reaper.JS_Window_SetOpacity(identifier windowHWND, string mode, number value)

mode: either "ALPHA" or "COLOR". 
value: If ALPHA, the specified value may range from zero to one, and will apply to the entire window. 
If COLOR, value specifies a 0xRRGGBB color, and all pixels in this color will be made transparent. (All mouse clicks over transparent pixels will pass through, too).
deeb is offline   Reply With Quote
Old 07-07-2019, 10:30 AM   #611
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,209
Default

Quote:
Originally Posted by mespotine View Post
How can I access dropdown/context-menüs programmatically?
I hope I'm wrong but doesn't seem possible, as soon as a context menu is shown all lua scripts are paused until the menu is closed, I'm guessing we need a defer option that runs on it own thread?

EDIT, not a context menu, maybe a regular menu?

Last edited by Edgemeal; 07-07-2019 at 11:24 AM.
Edgemeal is offline   Reply With Quote
Old 07-07-2019, 10:36 AM   #612
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

Ok. Maybe I can add that stuff somehow into my API. Thanks
__________________
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 07-07-2019, 11:26 AM   #613
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

I don't know. But I think, it's a context menu. But I'm not deep enough in such things to know, what kind of menus exist.
__________________
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 07-07-2019, 12:39 PM   #614
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,209
Default RE-POST

Quote:
Originally Posted by mespotine View Post
I don't know. But I think, it's a context menu. But I'm not deep enough in such things to know, what kind of menus exist.
Your right, it is a menu, it has a classname #32768, and to my surprise a defer-loop script didn't stop when it was shown, so maybe there is hope, you need to figure out where to send it a click message thouguh, not sdure how you do that without help of the GetMenuItemRect Win32 API.

Testing, how to get handle of a Menu (Windows classname #32768) and click top menu item.
Code:
function msg(str)
  reaper.ShowConsoleMsg(tostring(str) .. '\n')
end

function Post_LMouseDownUp(hwnd, x, y)
  reaper.JS_WindowMessage_Post(hwnd, "WM_LBUTTONDOWN", 1, 0, x, y)
  reaper.JS_WindowMessage_Post(hwnd, "WM_LBUTTONUP", 0, 0, x, y)
end

function FindMenu() 
 local arr = reaper.new_array({}, 255)
 local ret = reaper.JS_Window_ArrayAllTop(arr)
 if ret < 1 then return end
 local childs = arr.table()
  for j = 1, #childs do
    local hwnd = reaper.JS_Window_HandleFromAddress(childs[j])
    if reaper.JS_Window_GetClassName(hwnd) == "#32768" then
     return hwnd
    end 
  end
end

local function main() 
    menuWindow = FindMenu() 
    if menuWindow ~= nil then -- Menu window found.
      --< Add code to click inside window @ specific point to select a menu item :) >--
      retval, left, top, right, bottom = reaper.JS_Window_GetRect(menuWindow) 
      -- Post_LMouseDownUp(menuWindow, left+4, top+4) -- <<<< Clicks top menu item ???
      msg(menuWindow)
      return -- exit
    end
   reaper.defer(main)
end

reaper.defer(main)

Last edited by Edgemeal; 07-07-2019 at 01:11 PM. Reason: comment out click code, could be dangerous :-)
Edgemeal is offline   Reply With Quote
Old 07-07-2019, 02:52 PM   #615
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 360
Default

Hi JulianSader.
I'm trying to use reascript to change Project Tabs' order. See in this LICECap:

There's no way for me to change the order of Song 14, Song 15, Song 16, etc...

Mespotine told me there might be a way using your extension's childID?
I'm not too experienced yet in all of this but maybe you could enlight me if it is feasible to reorder tabs with reascript using your stuff?
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11.6, MBP 17" 2011 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, DP9, PT 11, Logic Pro X, Bidule, M5 3, BFD2, SD2, Omnisphere, Wave Altiverb, PSP, VB3, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is online now   Reply With Quote
Old 07-07-2019, 03:16 PM   #616
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

To add to lexaproductions, I think Click+Mousedragging-stuff could work for that, but I don't know, if such windows-messages exist in swell to do that...

And I don't know, if there's a way to find out, where which tab is...
__________________
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 07-12-2019, 09:14 AM   #617
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,317
Default

Maybe useful for finding the right localized-texts:

I made a LangPack-file, which shows to the left of the text the section, in which you can find it.
This is probably useful, when wanting to get the right hwnd-text, as some texts in the LangPacks are duplicated.

It looks like this:


You can get it here: https://raw.githubusercontent.com/Ul...ReaperLangPack

Just use it, as any other language-pack-file.
__________________
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 07-13-2019, 03:46 PM   #618
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,621
Default

Quote:
Originally Posted by lexaproductions View Post
Mespotine told me there might be a way using your extension's childID?
I'm not too experienced yet in all of this but maybe you could enlight me if it is feasible to reorder tabs with reascript using your stuff?
Unfortunately, I am not aware of any way to do this. (Someone else might know, though -- we can even ask the devs directly.)
juliansader 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:38 AM.


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