WEBVTT
00:00:00.099 --> 00:00:03.937
Hi, this is X-Raym, for the 8th part
of our ReaScript tutorial.
00:00:03.939 --> 00:00:08.090
Today, we will use a REAPER
native action inside our script.
00:00:08.092 --> 00:00:12.346
I will make this script select items
on which it has an effect.
00:00:12.347 --> 00:00:14.553
The function is the following.
00:00:25.871 --> 00:00:30.268
Here I need an item, and my items
are put in the variable item
00:00:30.269 --> 00:00:34.270
and for bolean selected, I put
either true or false, so I put true
00:00:34.271 --> 00:00:38.111
As I want my item to be selected
if they pass through here.
00:00:38.112 --> 00:00:40.498
If I run the script...
00:00:42.141 --> 00:00:44.321
we see that the items get selected.
00:00:44.322 --> 00:00:47.095
However, the previous ones
didn't get unselected.
00:00:47.096 --> 00:00:50.380
There is several way we can make it,
00:00:50.381 --> 00:00:55.256
but I'll show you one, that will
make you learn something new.
00:00:55.257 --> 00:00:59.623
We can run inside a script
actions coming from the actions list
00:00:59.624 --> 00:01:01.880
If we now their command ID.
00:01:01.881 --> 00:01:04.125
So, I will search for the action
00:01:04.126 --> 00:01:06.842
Unselect all items.
00:01:06.933 --> 00:01:09.759
I copy its ID.
00:01:11.809 --> 00:01:14.878
And I will paste it temporary...
00:01:14.879 --> 00:01:16.790
either here or here, it would have
the same result.
00:01:16.791 --> 00:01:21.465
So I put here here. Temporary.
00:01:21.466 --> 00:01:28.778
And I will look for the function called
Main_OnCommand
00:01:29.581 --> 00:01:37.140
which allow me to run
a REAPER action, within the script.
00:01:37.878 --> 00:01:42.431
As first parameter, the command ID
of the action
00:01:42.432 --> 00:01:45.160
as 2nd parameters, I put 0.
00:01:45.161 --> 00:01:50.315
A bit complicated to explain but most
of the time, 0 will be just fine.
00:01:50.316 --> 00:01:51.378
I select all.
00:01:51.379 --> 00:01:57.448
If I run the script, we see that the item
in time selection get selected.
00:01:57.449 --> 00:02:01.369
If I extend the time selection...
00:02:01.775 --> 00:02:03.985
Inside the time selection
and on selected track!
00:02:03.986 --> 00:02:06.638
If I unselect this track...
00:02:06.654 --> 00:02:08.139
and I run the script again...
00:02:08.139 --> 00:02:09.805
This item get unselected.
00:02:09.806 --> 00:02:14.811
In the next episode, we will see how to prevent
errors that may be caused by our script.