Old 03-21-2019, 07:26 AM   #1
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 827
Default API-questions: What do these functions do?

I tried to document several functions time and again, but many of them are totally a mystery to me, or at least some of their parameters.

So maybe, you can help me with these:

reaper.Main_OnCommand(integer command, integer flag)
What does the parameter flag do? I tried to bruteforce it, I hoped, it would be communicated to get_action_context but nothing. I can't trigger that to do anything at all.

reaper.Main_UpdateLoopInfo(integer ignoremask)
What does this function? And if you know it, what does ignoremask mean?

string out = reaper.image_resolve_fn(string in, string out)
What's the purpose of this function?

string out = reaper.resolve_fn(string in, string out)
string out = reaper.resolve_fn2(string in, string out, optional string checkSubDir)
How do they work? I couldn't figure them out.

string retval, optional string desc, optional number value, optional number defValue, optional number minValue, optional number maxValue = reaper.ThemeLayout_GetParameter(integer wp)
I tried to bruteforce by indexing wp through millions of integers, but the function didn't return something useful. How does this work?

boolean retval = reaper.ThemeLayout_SetParameter(integer wp, integer value, boolean persist)
or that one.

ReaProject = reaper.GetCurrentProjectInLoadSave()
what does this do exactly? Or is it only useful from C++?


and all docker get/set-functions, though I think, no one figured them out yet, properly.
lua_gfx.dock
DockIsChildOfDock
DockWindowActivate
DockWindowAdd
DockWindowAddEx
DockWindowRefresh
DockWindowRefreshForHWND
DockWindowRemove
Dock_UpdateDockID



Have you some idea about them?
__________________
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 03-21-2019, 08:12 AM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,651
Default

Quote:
Originally Posted by mespotine View Post
string retval, optional string desc, optional number value, optional number defValue, optional number minValue, optional number maxValue = reaper.ThemeLayout_GetParameter(integer wp)
I tried to bruteforce by indexing wp through millions of integers, but the function didn't return something useful. How does this work?

boolean retval = reaper.ThemeLayout_SetParameter(integer wp, integer value, boolean persist)
or that one.
Those were only added recently. My understanding is that a theme can declare parameters in its WALTER that are then exposed to scripts.

Quote:
lua_gfx.dock
gfx.dock(v[,wx,wy,ww,wh])
Call with v=-1 to query docked state, otherwise v>=0 to set docked state. State is &1 if docked, second byte is docker index (or last docker index if undocked). If wx-wh specified, additional values will be returned with the undocked window position/size


My GUI uses it in a couple of places.

Code:
        -- Measure the window's title bar, in case we need it
        local __, __, wnd_y, __, __ = gfx.dock(-1, 0, 0, 0, 0)
        local __, gui_y = gfx.clienttoscreen(0, 0)
        GUI.title_height = gui_y - wnd_y
Code:
-- Saves the current script window parameters to an ExtState under the given section name
-- Returns dock, x, y, w, h
GUI.save_window_state = function (name, title)

    if not name then return end
    local state = {gfx.dock(-1, 0, 0, 0, 0)}
    reaper.SetExtState(name, title or "window", table.concat(state, ","), true)

    return table.unpack(state)

end
Lokasenna is online now   Reply With Quote
Old 03-21-2019, 09:40 AM   #3
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 827
Default

Quote:
Originally Posted by Lokasenna View Post
gfx.dock(v[,wx,wy,ww,wh])


My GUI uses it in a couple of places.
Could you control, into which docker the script is added? This confused me the most, that the order of the dockerindex changed, depending on how many dockers are available. So dockerindex 1 could be 1 docker in one installation, while it is another one in another installation. It has something to do with the screensets(?) or theme(?).

Well...somehow...but I couldn't figure out, how. It was just confusing.
__________________
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 03-21-2019, 09:43 AM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 827
Default

Quote:
Originally Posted by Lokasenna View Post
Those were only added recently. My understanding is that a theme can declare parameters in its WALTER that are then exposed to scripts.
That is interesting. That means, I could define certain values to be influenced from ReaScript and others stay uninfluenced (or unfluenced? )?

Hmmm...that's interesting...
__________________
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 03-21-2019, 09:45 AM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,651
Default

I would expect the dockers to be numbered in order of creation, but that's a complete guess.

It would be trivial to write a script that goes through all of the dockers, gets their coordinates, and shows a diagram with numbers in a script window so you can see how they're working.
Lokasenna is online now   Reply With Quote
Old 03-21-2019, 03:54 PM   #6
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,545
Default

Quote:
Originally Posted by mespotine View Post
reaper.Main_OnCommand(integer command, integer flag)
What does the parameter flag do? I tried to bruteforce it, I hoped, it would be communicated to get_action_context but nothing. I can't trigger that to do anything at all.
Actions (including extension-provided actions) can use the flag parameter in an action-defined way. (It's unused in SWS and I'm not aware of any native action that uses it.)
cfillion is online now   Reply With Quote
Old Yesterday, 05:58 AM   #7
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 827
Default

Quote:
Originally Posted by cfillion View Post
Actions (including extension-provided actions) can use the flag parameter in an action-defined way. (It's unused in SWS and I'm not aware of any native action that uses it.)
Ok. Can this be used in scripts as well? And what do I differentiate with that? Is this a "parameter" that can be read by the action?
__________________
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
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 03:28 PM.


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