edit.
The latest version (zip-file) is in the post #13:
http://forum.cockos.com/showpost.php...1&postcount=13
Create send-track(s) from selected track(s)
Note: uses beta-function "SNM_AddReceive" (SWS extension v.2.3.0 Build #17)
edit: update for Sexan - disable master/parent send for newly created tracks (1. script) or selected (source) tracks (2. script):
Create send-track(s) from selected track(s) and disable master/parent send for newly created (receiving) tracks:
Code:
# Note: uses beta-function "SNM_AddReceive"
# Create send-track(s) from selected track(s)
# and disable master/parent send for newly created (receiving) tracks
from sws_python import *
from contextlib import contextmanager
@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0, message, -1)
with undoable("Create send-tracks from selected tracks"):
def msg(m):
RPR_ShowConsoleMsg(m)
trackCount = RPR_CountSelectedTracks(0)
if trackCount > 0:
for i in range(trackCount):
trackId = RPR_GetSelectedTrack(0, i)
name = RPR_GetSetMediaTrackInfo_String(trackId, "P_NAME", "", 0)[3]
RPR_InsertTrackAtIndex(RPR_CountTracks(0), 1)
receiveTrackId = RPR_GetTrack(0, RPR_CountTracks(0) - 1)
RPR_GetSetMediaTrackInfo_String(receiveTrackId, "P_NAME", name + str(" SEND"), 1)
# disable master/parent send for newly created (receiving) tracks
RPR_SetMediaTrackInfo_Value(receiveTrackId, "B_MAINSEND", 0)
a = SNM_AddReceive(trackId, receiveTrackId, -1) # -1=Default type (user preferences), 0=Post-Fader (Post-Pan), 1=Pre-FX, 2=deprecated, 3=Pre-Fader (Post-FX)
if a == 0:
msg("Absolutely nothing happened (nothing updated")
# remove next 2 lines to set new tracks to default color
else:
RPR_SetTrackColor(receiveTrackId, 0x00FFCC00) # color = 0x00BBGGRR
# update view
RPR_TrackList_AdjustWindows(False)
RPR_UpdateArrange()
Create send-track(s) from selected track(s) and disable master/parent send for selected (sending) tracks:
Code:
# Note: uses beta-function "SNM_AddReceive"
# Create send-track(s) from selected track(s)
# and disable master/parent send for selected (sending) tracks
from sws_python import *
from contextlib import contextmanager
@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0, message, -1)
with undoable("Create send-tracks from selected tracks"):
def msg(m):
RPR_ShowConsoleMsg(m)
trackCount = RPR_CountSelectedTracks(0)
if trackCount > 0:
for i in range(trackCount):
trackId = RPR_GetSelectedTrack(0, i)
name = RPR_GetSetMediaTrackInfo_String(trackId, "P_NAME", "", 0)[3]
RPR_InsertTrackAtIndex(RPR_CountTracks(0), 1)
receiveTrackId = RPR_GetTrack(0, RPR_CountTracks(0) - 1)
RPR_GetSetMediaTrackInfo_String(receiveTrackId, "P_NAME", name + str(" SEND"), 1)
# disable master/parent send for selected (sending) tracks
RPR_SetMediaTrackInfo_Value(trackId, "B_MAINSEND", 0)
a = SNM_AddReceive(trackId, receiveTrackId, -1) # -1=Default type (user preferences), 0=Post-Fader (Post-Pan), 1=Pre-FX, 2=deprecated, 3=Pre-Fader (Post-FX)
if a == 0:
msg("Absolutely nothing happened (nothing updated")
# remove next 2 lines to set new tracks to default color
else:
RPR_SetTrackColor(receiveTrackId, 0x00FFCC00) # color = 0x00BBGGRR
# update view
RPR_TrackList_AdjustWindows(False)
RPR_UpdateArrange()