Old 05-19-2021, 11:40 AM   #801
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by FNGL View Post
Hi! This is my first time writing my own ReaScript, so I'm in need of some basic help.

I'm trying to make a script that can group things for me on an unused group. So, I'm wondering how I can get a list of groups? And if there is an obvious way to filter out the groups that are busy, I'd love to hear about that too!
What kind of groups are you referring to? Item groups? Track groups? Something else?
__________________
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 05-19-2021, 01:40 PM   #802
FNGL
Human being with feelings
 
FNGL's Avatar
 
Join Date: Jun 2018
Location: Norway
Posts: 5
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
What kind of groups are you referring to? Item groups? Track groups? Something else?
Oh, sorry, track groups.
FNGL is offline   Reply With Quote
Old 05-20-2021, 03:51 AM   #803
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by nofish View Post
But I'd suggest using native functions GetMousePosition and GetItemFromPoint instead of BR_GetMouseCursorContext as it seems more reliable I've read here.
I tried to use these two functions in lua script.
Script saved ok, but when i try to run it by shortcut it shows such error: AZ_Split items under mouse cursor.lua:7: attempt to call a nil value (global 'split_mouse')

What is wrong?
And what means flag, which needs to be a value?
reaper.Main_OnCommandEx( command, flag, proj )

Here my script:
Code:
x, y = reaper.GetMousePosition()
item = reaper.GetItemFromPoint( x, y, false )

if item then
reaper.PreventUIRefresh( 1 )
split_mouse()
reaper.PreventUIRefresh( -1 )

else
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_SMARTSPLIT2" ), 0, 0 )
end


function split_mouse()
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_SAVEALLSELITEMS1" ), 0, 0 )
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_BR_SAVE_CURSOR_POS_SLOT_1" ), 0, 0 )
reaper.Main_OnCommandEx( 40513, flag, 0 ) -- move edit cursor to mouse
reaper.SetMediaItemSelected( item, selected ) -- select item under mouse
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_SMARTSPLIT2" ), 0, 0 ) -- CENTRAL FUNCTION
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_RESTALLSELITEMS1" ), 0, 0 )
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_SAVEVIEW" ), 0, 0 )
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_BR_RESTORE_CURSOR_POS_SLOT_1" ), 0, 0 )
reaper.Main_OnCommandEx(  reaper.NamedCommandLookup( "_SWS_RESTOREVIEW" ), 0, 0 )
end
AZpercussion is offline   Reply With Quote
Old 05-20-2021, 05:59 AM   #804
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by AZpercussion View Post
I tried to use these two functions in lua script.
Script saved ok, but when i try to run it by shortcut it shows such error: AZ_Split items under mouse cursor.lua:7: attempt to call a nil value (global 'split_mouse')

What is wrong?
When you call the split_mouse function the script hasn't 'seen' the function definition yet so it doesn't know what to do.
You need to move the function definition (function split_mouse() ...) somewhere before it gets called.

Quote:
And what means flag, which needs to be a value?
reaper.Main_OnCommandEx( command, flag, proj )
https://forum.cockos.com/showthread.php?t=212712
In short, you can simply use 0 for it.
nofish is offline   Reply With Quote
Old 05-21-2021, 09:25 AM   #805
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by nofish View Post
When you call the split_mouse function the script hasn't 'seen' the function definition yet so it doesn't know what to do.
You need to move the function definition (function split_mouse() ...) somewhere before it gets called.



https://forum.cockos.com/showthread.php?t=212712
In short, you can simply use 0 for it.
Thanks a lot!!! I made it!!
AZpercussion is offline   Reply With Quote
Old 05-21-2021, 10:37 AM   #806
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by AZpercussion View Post
Thanks a lot!!! I made it!!
Nice! You're welcome.
nofish is offline   Reply With Quote
Old 05-21-2021, 01:31 PM   #807
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

hm I was searching for a function to return track group but I didn't found maybe you need go into chunks?

In tracks chunks there is the
Code:
  GROUP_FLAGS some_number
that you can manipule the group of each track. You would have to go into each track chunk to know if they are or not in that group
daniellumertz is offline   Reply With Quote
Old 05-21-2021, 01:50 PM   #808
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by daniellumertz View Post
hm I was searching for a function to return track group but I didn't found maybe you need go into chunks?

In tracks chunks there is the
Code:
  GROUP_FLAGS some_number
that you can manipule the group of each track. You would have to go into each track chunk to know if they are or not in that group
https://mespotin.uber.space/Ultrasch...roupMembership
https://mespotin.uber.space/Ultrasch...MembershipHigh

They are quite tedious to use.
I made some variants of them in Ultraschall-Api, that are easier to use but I spotted an error in the documentation.
I'll fix it and post links to them as well...
__________________
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 05-21-2021, 01:58 PM   #809
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

oh nice to hear Mespotine! I was thinking in making a function to get the track group or to get the tracks from group. GetSetTrackGroupMembership seems to just return the values of the group setting if I understood correctly...
daniellumertz is offline   Reply With Quote
Old 05-21-2021, 03:29 PM   #810
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by daniellumertz View Post
oh nice to hear Mespotine! I was thinking in making a function to get the track group or to get the tracks from group. GetSetTrackGroupMembership seems to just return the values of the group setting if I understood correctly...
Nope, hence the GetSetTrackGroupMembership in the name
__________________
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 05-21-2021, 05:18 PM   #811
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

Ohhhh that is what mean the Set. I thought Set mean just "Set" and we were choosing between Get and Set
daniellumertz is offline   Reply With Quote
Old 05-21-2021, 05:40 PM   #812
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Yup:

Quote:
if setmask has bits set, those bits in setvalue will be applied to group
As I said, it tedious and quite confusing to use these functions with a lot of bitfumbling.

How do the setmask/setvalue-parameters work in general?

So, setmask-parameter is the one, that signals, which group's checkbox shall be set/unset, where the setvalue-parameter signals, how they shall be set.
The setmask and setvalue-parameters must be seen as bitfields, where each bit represents each group:

The first one group 1 (value 2^1).
The second one group 2 (value 2^2).
The third one group 3 (value 2^3).
The fourth one group 4 (value 2^4).
...
...
The thirtysecond bit one group 32 (value 2^32).

To chose a certain group in these parameters, just add the 2^groupnumber to the setmask or setvalue parameters.

The setmask parameter

So to choose, which group shall be affected(but not, how they shall be affected), just add the value of the bit to the setmask-parameter.

So to choose group 1 and 3, add 2^1 + 2^3 to setmask.
To choose group 1, 2 and 8, add 2^1 + 2^2 + 2^8 to setmask.

This will choose the groups that shall be set in any way. Now, how do we set the checkboxes to set/unset?

The setvalue-parameter

Let's choose, how these shall be set. If you want to set a certain group as selected, add the value of the group into setvalue, otherwise leave it 0 to set all affected groups to unset(all checkboxes unchecked for these groups).

So if you chose groups 1, 2 and 8 and you want to set the checkbox for
group 1 and 8 but NOT 2, add 2^1 + 2^8 to setvalue.

If you chose groups 1, 2 and 8 and you want to set the checkbox for group 1, 2 and 8, add 2^1 + 2^2 + 2^8 to setvalue.

If you chose groups 1, 2 and 8 and you want to unset all of them, simply make setvalue=0

Some examples:

For instance with track 1:

Code:
returnvalue = reaper.GetSetTrackGroupMembership(reaper.GetTrack(0,0), "VOLUME_LEAD", 1, 1)
will set the Volume Lead-checkbox for group 1 to checked.

Code:
returnvalue = reaper.GetSetTrackGroupMembership(reaper.GetTrack(0,0), "VOLUME_LEAD", 1, 0)
will set the Volume Lead-checkbox for group 1 to UNchecked.

Code:
returnvalue = reaper.GetSetTrackGroupMembership(reaper.GetTrack(0,0), "VOLUME_LEAD", 3, 3)
will set the Volume Lead-checkbox for group 1 and 2(combined by 2^1 + 2^2 in setmask) both to checked.

Code:
returnvalue = reaper.GetSetTrackGroupMembership(reaper.GetTrack(0,0), "VOLUME_LEAD", 3, 0)
will set the Volume Lead-checkbox for group 1 and 2(combined as 2^1 + 2^2 in setmask) both to UNchecked (setvalue=0).


Now to some of the more harder to get one:

Code:
returnvalue = reaper.GetSetTrackGroupMembership(reaper.GetTrack(0,0), "VOLUME_LEAD", 3, 1)
will set the Volume Lead-checkbox for group 1 and 2(combined as 2^1 + 2^2 in setmask), with group 1=set and group 2=unset (2^1 + 0).

Edit:

Oh, and for the groups 33 through 64, you need to use GetSetTrackGroupMembershipHigh.
The calculation for these groups is then:

2^(33-32)+2^(34-32)+2^(40-32) for groups 33, 34 and 40
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 05-21-2021 at 05:57 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-21-2021, 07:41 PM   #813
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

ohh this is a amazing explanation I am sure the OP will have his/hers answers in it, I might get back here when I need some info about track groups. Thanks for the effort/time Mespotine!
daniellumertz is offline   Reply With Quote
Old 05-25-2021, 01:39 AM   #814
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Does anybody know how to get automation item from point? Like media item from screen point.

I want to combine split actions in one script to have mouse context split.
AZpercussion is offline   Reply With Quote
Old 05-25-2021, 03:07 AM   #815
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by AZpercussion View Post
Does anybody know how to get automation item from point? Like media item from screen point.

I want to combine split actions in one script to have mouse context split.
You get envelope from point using BR_GetMouseCursorContext_Envelope:

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

then the project time under mouse using BR_GetMouseCursorContext_Position

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

and then check against start/endposition of the automation items in the envelope you've found.
__________________
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 05-25-2021, 06:19 AM   #816
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
You get envelope from point using BR_GetMouseCursorContext_Envelope

then the project time under mouse using BR_GetMouseCursorContext_Position

and then check against start/endposition of the automation items in the envelope you've found.
Hmm, it seems a way to get an index of automation item. But there is no function to split item by index.
How I can get or select this item found by index to let action Split automation item know what item needs to split?
AZpercussion is offline   Reply With Quote
Old 05-25-2021, 07:31 AM   #817
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
You get envelope from point using BR_GetMouseCursorContext_Envelope:

https://mespotin.uber.space/Ultrasch...ntext_Envelope
The BR_Envelope functions don't support (getting envelope points within) automation items currently unfortunately.
https://github.com/reaper-oss/sws/issues/922

edit:
I kinda misread.
For getting the envelope it should work I think, just not for getting the envelope points within AIs.
nofish is offline   Reply With Quote
Old 05-25-2021, 10:21 AM   #818
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by AZpercussion View Post
Hmm, it seems a way to get an index of automation item. But there is no function to split item by index.
How I can get or select this item found by index to let action Split automation item know what item needs to split?
https://mespotin.uber.space/Ultrasch...mationItemInfo

You get position and length and check, whether the projectposition of the mouse is within position and position+length of the automation item.
If it is, you found the index of the automation item. If not, check index+1 and so on.

No idea though, how to split it.
You could try shortening it and use InsertAutomationItem to insert it again but move the offset of the newly inserted one.
It's fiddly, though...

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

Edit: I'm tempted to add both (find automation item and split automation item) into my Ultraschall-Api, as this could be actually helpful for others too...
__________________
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 05-25-2021, 12:33 PM   #819
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post

No idea though, how to split it.
You could try shortening it and use InsertAutomationItem to insert it again but move the offset of the newly inserted one.
It's fiddly, though...
I found the script for selecting all automation items under mouse in the Cfillion's Automation item selection bundle on the Reapack.
It looks complicated, yeah...
It only remains to figure out how make it select only one AI.

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Edit: I'm tempted to add both (find automation item and split automation item) into my Ultraschall-Api, as this could be actually helpful for others too...
Would be great!!!
AZpercussion is offline   Reply With Quote
Old 05-25-2021, 01:27 PM   #820
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by AZpercussion View Post
Would be great!!!
No promises though, as I'm currently quite slow in development so things can take several weeks to be included, if I'm able to pull that off anyway.

But I'll try.

Edit:

This should split all automation-items at mouse-cursor-position. This is largely untested so bugs may occur.

Code:
-- Meo-Ada Mespotine - 26th of May 2021
-- licensed under MIT-license
-- split all automation-items at mouse-cursor-position

function GetAutomationItemsByTime(Env, time)
  -- get all automation-items in envelope env at time-position
  -- returns the number of found automation-items and a table with all their indices
  local AItems={}
  local AItems_Count=0
  for i=0, reaper.CountAutomationItems(Env)-1 do
    local startposition=reaper.GetSetAutomationItemInfo(Env, i, "D_POSITION", 0, false)
    local length=reaper.GetSetAutomationItemInfo(Env, i, "D_LENGTH", 0, false)
    if time>=startposition and time<=startposition+length then
      AItems_Count=AItems_Count+1
      AItems[AItems_Count]=i
    end
  end
  return AItems_Count, AItems
end


function SplitAutomationItem(Env, position, index, selected)
  -- splits automation-item with index in envelope at position.
  -- selected chooses, whether the newly created automation-item shall be selected(1) or not(0) or retain selection(2)

  -- returns true in case of success

  local startposition=reaper.GetSetAutomationItemInfo(Env, index, "D_POSITION", 0, false)
  local length=reaper.GetSetAutomationItemInfo(Env, index, "D_LENGTH", 0, false)
  if position<=startposition or position>=startposition+length then
    return false
  end

  index=index+1
  local Selections={}
  for i=0, reaper.CountAutomationItems(Env)-1 do
    Selections[i]=reaper.GetSetAutomationItemInfo(Env, i, "D_UISEL", 0, false)
  end
  if selected==2 then selected=Selections[index-1] end
  table.insert(Selections, index, selected)
  reaper.PreventUIRefresh(1)
  for i=0, reaper.CountAutomationItems(Env)-1 do
    if i~=index-1 then
      reaper.GetSetAutomationItemInfo(Env, i, "D_UISEL", 0, true)
    else
      reaper.GetSetAutomationItemInfo(Env, i, "D_UISEL", 1, true)
    end
  end  
  local oldpos=reaper.GetCursorPosition()
  reaper.SetEditCurPos(position, false, false)
  reaper.Main_OnCommand(42087, 0)
  reaper.SetEditCurPos(oldpos, false, false)
  for i=0, reaper.CountAutomationItems(Env)-1 do
    reaper.GetSetAutomationItemInfo(Env, i, "D_UISEL", Selections[i], true)
  end 
  reaper.PreventUIRefresh(0)
  return true
end


-- get envelope and position at mouse-cursor
reaper.BR_GetMouseCursorContext()
Env=reaper.BR_GetMouseCursorContext_Envelope()
if Env==nil then return end
Pos=reaper.BR_PositionAtMouseCursor(false)

-- get automation-item-indices at mouse-cursor
aitems_num, aitems = GetAutomationItemsByTime(Env, Pos)

-- split them
for i=1, aitems_num do
  SplitAutomationItem(Env, Pos, aitems[i], 1)
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; 05-25-2021 at 04:17 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-30-2021, 10:40 PM   #821
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

I noticed, that the regular action "Split items at edit cursor" splits also automation items.
But there is an action to split only automation items at edit cursor.
And other actions like unselet all items etc have no influence on automation items.

It is HUGE inconsistence!

And we have no API functions for automation items to get more freedom.

So for now I can't combine different split actions in one smart handsomely.
AZpercussion is offline   Reply With Quote
Old 06-02-2021, 01:55 PM   #822
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default How do I get the Value of the envelope set in the TCP

How do I get the values of the red arrows shown in my screen capture?



On the envelope lanes, if I adjust the knob, the value at the bottom right corner changes. I'm looking to get that value, which can be different than what is actually occurring anywhere on the actual lane.

For example, if I'm in latch preview mode, I can set those values to something different than what is actually on my envelope.

Is there an API call that will return the value of the envelope set by the TCP and not on the track? I've been looking through the list and I'm drawing a blank.

Thanks for your help!


*** UPDATE ****

I found reaper.GetTrackUIVolPan( track ) which is giving me the values for the volume/Pan envelopes! But now I'm trying to figure out how to find the same thing for just the envelope of anything... FX parameter, Pre_FX Volume, etc...
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!

Last edited by sonictim; 06-02-2021 at 03:51 PM.
sonictim is offline   Reply With Quote
Old 06-11-2021, 12:11 AM   #823
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 1,167
Default Change toolbar at top of main window

How do I change toolbar at top of main window via script? Is it possible?
Daodan is offline   Reply With Quote
Old 06-11-2021, 12:44 AM   #824
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Daodan View Post
How do I change toolbar at top of main window via script? Is it possible?
What exactly do you want to change?
__________________
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 06-11-2021, 01:54 AM   #825
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 1,167
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
What exactly do you want to change?
Sorry I mean switch.
For example:
I have Toolbar 1. This toolbar position is "At top of main window" and I want to open Toolbar 2 instead of it.
I can right click in Toolbar 1 and choose switch toolbar->Toolbar 2
or right click in Toolbar 2 and choose Position->At top of main window.

The question is how to do this without mouse clicks.
I thought about scripts because I don't see any suitable actions.
Daodan is offline   Reply With Quote
Old 06-11-2021, 09:00 AM   #826
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Daodan View Post
Sorry I mean switch.
For example:
I have Toolbar 1. This toolbar position is "At top of main window" and I want to open Toolbar 2 instead of it.
I can right click in Toolbar 1 and choose switch toolbar->Toolbar 2
or right click in Toolbar 2 and choose Position->At top of main window.

The question is how to do this without mouse clicks.
I thought about scripts because I don't see any suitable actions.
Isn't possible to my knowledge. But you can have a look at screensets. They allow you to set up different toolbar-configurations. You set one up and store it as screenset, then set up another one and store this as another screenset.
You should be able to switch between them via actions.
__________________
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 06-11-2021, 01:32 PM   #827
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 1,167
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Isn't possible to my knowledge. But you can have a look at screensets. They allow you to set up different toolbar-configurations. You set one up and store it as screenset, then set up another one and store this as another screenset.
You should be able to switch between them via actions.
Thank you.
Sceensets work but not for toolbar at top of main window. It's some kind of special.
Ok, it's impossible. I can live with that.
Daodan is offline   Reply With Quote
Old 07-08-2021, 06:38 PM   #828
kotll
Human being with feelings
 
Join Date: Jun 2021
Posts: 65
Default

Is it possible to create a directory from Lua? I have a path like D:/aaa/bbb/ that doesn't exist and I'm trying to get Reaper to create that path.

Edit:

I'm silly, there's a Reaper function for doing that: reaper.RecursiveCreateDirectory(string path, integer ignored)

Last edited by kotll; 07-08-2021 at 06:44 PM. Reason: Found solution on my own
kotll is offline   Reply With Quote
Old 07-08-2021, 06:41 PM   #829
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by kotll View Post
Is it possible to create a directory from Lua? I have a path like D:/aaa/bbb/ that doesn't exist and I'm trying to get Reaper to create that path.
reaper.RecursiveCreateDirectory
cfillion is offline   Reply With Quote
Old 07-10-2021, 04:51 AM   #830
kotll
Human being with feelings
 
Join Date: Jun 2021
Posts: 65
Default

How do you check if a directory exists in Lua? I know I can check for files with reaper.file_exists(string path), but it doesn't work for folders...
kotll is offline   Reply With Quote
Old 07-10-2021, 01:07 PM   #831
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

You try to see, if EnumerateSubdirectories returns the folder. If not, it's not there.
__________________
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 07-13-2021, 09:32 AM   #832
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default MIDI note plypjony

I’ve been looking for a script that will limit the number of simultaneous midi notes that can be played in real time.

Anyone know of a midi input plug-in that does this?

To clarify:

When a note on is played, I don’t want any other note on events to pass through the channel.

If all notes are off then a note on can be passed.

Does this exist?
LarrySeyer is offline   Reply With Quote
Old 07-14-2021, 04:29 PM   #833
kotll
Human being with feelings
 
Join Date: Jun 2021
Posts: 65
Default

How do I rename an FX in reascript? I know I can retrieve the name with reaper.TrackFX_GetFXName, but is it not possible to set the name?
kotll is offline   Reply With Quote
Old 07-15-2021, 08:08 AM   #834
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by kotll View Post
How do I rename an FX in reascript? I know I can retrieve the name with reaper.TrackFX_GetFXName, but is it not possible to set the name?
Renaming is only possible via setting an alternative name, which will only change the name that is shown of the fx. Its original name stays intact.
My Ultraschall-API has the following functions for this:

Get the current alternative name:
https://mespotin.uber.space/Ultrasch...lternativeName
https://mespotin.uber.space/Ultrasch...lternativeName

Set a new alternative name:
https://mespotin.uber.space/Ultrasch...lternativeName
https://mespotin.uber.space/Ultrasch...lternativeName
__________________
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 07-15-2021, 10:04 AM   #835
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default Script window follow main Reaper window

I'm have two, sometimes three screens. And main reaper window not always placed at main screen. Most of the anothers scripts open their gui on screen with main reaper window, some of them remember their last position, but my script always opens at main screen.
How is it possible to influence on that?
AZpercussion is offline   Reply With Quote
Old 07-15-2021, 01:03 PM   #836
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by AZpercussion View Post
I'm have two, sometimes three screens. And main reaper window not always placed at main screen. Most of the anothers scripts open their gui on screen with main reaper window, some of them remember their last position, but my script always opens at main screen.
How is it possible to influence on that?
You can query the current window position of your gfx-window using gfx.dock
https://mespotin.uber.space/Ultrasch...l#lua_gfx.dock

and store the coordinates into an ExtState.
When starting the script, you read the old coordinates from the extstate and use them in the gfx.init-function to position the window.
__________________
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 07-16-2021, 02:46 AM   #837
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
You can query the current window position of your gfx-window using gfx.dock
https://mespotin.uber.space/Ultrasch...l#lua_gfx.dock

and store the coordinates into an ExtState.
When starting the script, you read the old coordinates from the extstate and use them in the gfx.init-function to position the window.
O! cool! Thanks!!
And in addition, isn't a way to ask main reaper window about its plasement?
AZpercussion is offline   Reply With Quote
Old 07-17-2021, 01:12 PM   #838
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Maybe but I don't know. Maybe by setting in Reaper.ini before starting Reaper.
But I never checked.
__________________
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 07-18-2021, 02:56 AM   #839
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Maybe but I don't know. Maybe by setting in Reaper.ini before starting Reaper.
But I never checked.
Okay, thanks!
Hmm, maybe it possible by getting context from point several times...
AZpercussion is offline   Reply With Quote
Old 07-18-2021, 07:01 AM   #840
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by AZpercussion View Post
, isn't a way to ask main reaper window about its plasement?
Not sure if this helps, just some code I was messing around with on Win10 with two monitors...

Code:
_, reaper_left = reaper.JS_Window_GetClientRect(reaper.GetMainHwnd())
display_cnt = reaper.NF_Win32_GetSystemMetrics(80) -- SM_CMONITORS = 80
screen_cnt = 1
display = {}
right = 0

for i = 0, display_cnt-1 do -- loop thru # of displays
  left, top, right, bottom = reaper.JS_Window_GetViewportFromRect(right+1, 0, 0, 0, true) 
  if reaper_left >= right then screen_cnt = screen_cnt + 1 end 
  display[i+1] = {x=left, y=top, w=right-left, h=bottom-top}
  if i > 0 then display[i+1].x = display[i+1].x + 1 end
end

for i = 1, #display do
  reaper.ShowConsoleMsg('#'.. i ..': ' .. display[i].w .. ' x ' .. display[i].h ..
                        ', x = ' .. display[i].x .. ', y = ' .. display[i].y .. '\n')
end

reaper.ShowConsoleMsg("Reaper is on display #".. screen_cnt .. "\n")
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 08:10 AM.


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