Return to Video

Lua Scripting with REAPER 5 - Part. 8: Using Native Actions

  • 0:00 - 0:04
    Hi, this is X-Raym, for the 8th part
    of our ReaScript tutorial.
  • 0:04 - 0:08
    Today, we will use a REAPER
    native action inside our script.
  • 0:08 - 0:12
    I will make this script select items
    on which it has an effect.
  • 0:12 - 0:15
    The function is the following.
  • 0:26 - 0:30
    Here I need an item, and my items
    are put in the variable item
  • 0:30 - 0:34
    and for bolean selected, I put
    either true or false, so I put true
  • 0:34 - 0:38
    As I want my item to be selected
    if they pass through here.
  • 0:38 - 0:40
    If I run the script...
  • 0:42 - 0:44
    we see that the items get selected.
  • 0:44 - 0:47
    However, the previous ones
    didn't get unselected.
  • 0:47 - 0:50
    There is several way we can make it,
  • 0:50 - 0:55
    but I'll show you one, that will
    make you learn something new.
  • 0:55 - 1:00
    We can run inside a script
    actions coming from the actions list
  • 1:00 - 1:02
    If we now their command ID.
  • 1:02 - 1:04
    So, I will search for the action
  • 1:04 - 1:07
    Unselect all items.
  • 1:07 - 1:10
    I copy its ID.
  • 1:12 - 1:15
    And I will paste it temporary...
  • 1:15 - 1:17
    either here or here, it would have
    the same result.
  • 1:17 - 1:21
    So I put here here. Temporary.
  • 1:21 - 1:29
    And I will look for the function called
    Main_OnCommand
  • 1:30 - 1:37
    which allow me to run
    a REAPER action, within the script.
  • 1:38 - 1:42
    As first parameter, the command ID
    of the action
  • 1:42 - 1:45
    as 2nd parameters, I put 0.
  • 1:45 - 1:50
    A bit complicated to explain but most
    of the time, 0 will be just fine.
  • 1:50 - 1:51
    I select all.
  • 1:51 - 1:57
    If I run the script, we see that the item
    in time selection get selected.
  • 1:57 - 2:01
    If I extend the time selection...
  • 2:02 - 2:04
    Inside the time selection
    and on selected track!
  • 2:04 - 2:07
    If I unselect this track...
  • 2:07 - 2:08
    and I run the script again...
  • 2:08 - 2:10
    This item get unselected.
  • 2:10 - 2:15
    In the next episode, we will see how to prevent
    errors that may be caused by our script.
Title:
Lua Scripting with REAPER 5 - Part. 8: Using Native Actions
Description:

Source Article and Exercice:
http://extremraym.com/en/reascript-video-using-native-actions

Please consider making a donation if you liked it:
http//extremraym.com/en/donation

Cheers !

more » « less
Video Language:
French
Duration:
02:17

English, British subtitles

Revisions