get_items_in_time_range
Retrieve all media items on a track within a specified time range. Returns both a positional index and a permanent ID for reliable item tracking.
Instructions
Get all items on a track within a time range.
Returns items with BOTH identification methods for each item:
track_pos_idx (integer):
Simple sequential index: 0, 1, 2, 3...
Easy to use in loops and quick operations
Changes if items before it are deleted
direct_item_id (string):
REAPER's permanent internal ID like "MediaItem*0x..."
Unique stable reference that never changes
Use this for reliable long-term item tracking
You can use either one in subsequent operations like add_midi_note.
Args: track_index: 0-based track index (0 = first track, 1 = second, etc.) start_time: Start position in seconds (optional if start_measure is provided) end_time: End position in seconds (optional if end_measure is provided) start_measure: Start position as "measure:beat,fraction" (optional if start_time is provided) end_measure: End position as "measure:beat,fraction" (optional if end_time is provided)
Returns: Each item includes: - track_pos_idx: Integer position index (0, 1, 2...) - direct_item_id: String internal ID ("MediaItem*...") - position: Item start time in seconds - length: Item duration in seconds
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_time | No | ||
| start_time | No | ||
| end_measure | No | ||
| track_index | Yes | ||
| start_measure | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |