|
|
|
12-13-2023, 11:34 AM
|
#1
|
Human being with feelings
Join Date: Apr 2021
Location: Syracuse, NY
Posts: 103
|
Last selected track or item?
Hey hey,
I'm looking to find whether a track OR item was last touched via ReaScript/Lua.
There are ways to find last touched track or last touched item, but that's not what I need. I want to find the last context that was interacted with - either track or item.
I have a number of script concepts that I'd love to roll out but I'm waiting on this ability. One example is a script that will either add items to a group OR tracks to a group depending on what was selected last.
I'd rather not use a deferred script for this, I'd like a tidy solution.
Am I overthinking this? Is there a more elegant way to accomplish what I want?
As always, thanks in advance..
__________________
Jason "Jocko" Randall
More Sound Recording Studio
Syracuse, NY
|
|
|
12-13-2023, 12:54 PM
|
#2
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
Aren't the functions GetCursorContext() and GetCursorContext2 suitable for your use case?
|
|
|
12-13-2023, 01:00 PM
|
#3
|
Human being with feelings
Join Date: Apr 2021
Location: Syracuse, NY
Posts: 103
|
It's a decent workaround, but is prone to error - if the user moves the mouse a little bit off the TCP area it's going to return the wrong data.
__________________
Jason "Jocko" Randall
More Sound Recording Studio
Syracuse, NY
|
|
|
12-13-2023, 01:22 PM
|
#4
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
Using a script a user does this with a certain purpose, so if they want to add an object to a group they will have to point out that object to the script, unless it's supposed to be added to a group without user direct involvement.
|
|
|
12-13-2023, 02:41 PM
|
#5
|
Human being with feelings
Join Date: Apr 2021
Location: Syracuse, NY
Posts: 103
|
Let me explain another way.
Take action #40035 - "Select all items/tracks/envelope points (depending on focus)"
This action is great. If I've clicked on a track last, it selects all tracks. If I've clicked on an item last, it selects all items. It does not require my mouse to be in any specific position. It works by last selection.
This is what I want to do, except within my script.
Thoughts?
__________________
Jason "Jocko" Randall
More Sound Recording Studio
Syracuse, NY
|
|
|
12-14-2023, 03:28 AM
|
#6
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
OK, i guess this action can be used to suss out the last touched object.
The function or a series of functions to do so will include
1. Storing all selected objects of the type which the action is able to detect.
2. Deselecting all such objects.
3. Running the action.
4. Checking which of the deselected objects got selected and storing these data.
5. Restoring the original selection.
6. Returning the stored data.
The only PITA is writing the routine for storing and restoring envelope point selection which though tedious is still doable.
UPD: Actually the functions GetCursorContext return the last mouse click context regardless of the current mouse cursor position.
So the only context which needs validation with the action is item because they return 1 as long as Arrange was last clicked and not necessarily an item.
Last edited by Buy One; 12-14-2023 at 04:38 AM.
|
|
|
12-16-2023, 10:40 AM
|
#7
|
Human being with feelings
Join Date: Apr 2021
Location: Syracuse, NY
Posts: 103
|
Thank you so much. I really appreciate you putting your mind to this. I'm working on some scripts now!
__________________
Jason "Jocko" Randall
More Sound Recording Studio
Syracuse, NY
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:55 AM.
|