Hi, this is X-Raym, for the 8th part of our ReaScript tutorial.
Today, we will use a REAPER native action inside our script.
I will make this script select items on which it has an effect.
The function is the following.
Here I need an item, and my items are put in the variable item
and for bolean selected, I put either true or false, so I put true
As I want my item to be selected if they pass through here.
If I run the script...
we see that the items get selected.
However, the previous ones didn't get unselected.
There is several way we can make it,
but I'll show you one, that will make you learn something new.
We can run inside a script actions coming from the actions list
If we now their command ID.
So, I will search for the action
Unselect all items.
I copy its ID.
And I will paste it temporary...
either here or here, it would have the same result.
So I put here here. Temporary.
And I will look for the function called Main_OnCommand
which allow me to run a REAPER action, within the script.
As first parameter, the command ID of the action
as 2nd parameters, I put 0.
A bit complicated to explain but most of the time, 0 will be just fine.
I select all.
If I run the script, we see that the item in time selection get selected.
If I extend the time selection...
Inside the time selection and on selected track!
If I unselect this track...
and I run the script again...
This item get unselected.
In the next episode, we will see how to prevent errors that may be caused by our script.