Автоматическое переименование при копировании треков(скрипт)

  • Автор темы Автор темы nounaim
  • Дата начала Дата начала

nounaim

Active Member
29 Авг 2010
329
65
28
Скрипт сам называет/ нумерует треки при копировании, может не последняя версия, пишите если найдутся косяки какие

PHP:
function namebyvstiname()
(
TrackFX_GetFXName(track, 0, #buf);
selected_tracks_count = CountSelectedTracks(0);
i = 0;
  loop(selected_tracks_count,
  (track = GetSelectedTrack(0, i)) ? (
  vsti_id = TrackFX_GetInstrument(track);
////Get VSTi name
  TrackFX_GetFXName(track, vsti_id, #buf);
  lenvstname=strlen(#buf);
  while (str_getchar(#buf, lenvstname, c) != 40) // count down from end to find "(" char
  (
  lenvstname=lenvstname-1; // count down from end
  );
str_setlen(#buf,lenvstname-1);
  name=GetSetMediaTrackInfo_String(track, "P_NAME",#trn, 0);
  emptyname=strcmp("",#trn);
  emptyname==0 ? (
  GetSetMediaTrackInfo_String(track, "P_NAME",#buf, 1);
  trl=trl+1;
  );
); //
i += 1;
); // end loop vstid

//////////////////////////////////////
);

function duplicatetracks()
(

seltrackscount1=CountSelectedTracks(0);
// Dupliacate tracks
Main_OnCommand(40062, 0);

// Unselect all items
Main_OnCommand(40289, 0);

///Go next track (mcp)
seltrackscount1==1 ? (

//go to next track (leaving other tracks selected)
Main_OnCommand(40287, 0);
);

track = GetSelectedTrack(0, 0);
name = GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name, 0);

// FIND "#" (sharp)

len=strlen(#current_track_name);

getchar=str_getchar(#current_track_name,0,c);
);// end function duplicate track

///////////////////////////////////////////// Rename empty track
function renameemptytrack()
(
seltrackscount1=CountSelectedTracks(0);
ei=0;
loop(seltrackscount1,
track = GetSelectedTrack(0, ei);
name = GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name2, 0);
emptyname=strcmp("",#current_track_name2);
#unnamed="unnamed";
emptyname==0 ? (

track = GetSelectedTrack(0, ei);
GetSetMediaTrackInfo_String(track, "P_NAME", #unnamed, 1);
);
ei=ei+1;
);
);
//////////////////////////////////////////////////////////
///////////////////////////////////////////// Add "#1" for second track copy
function add_n1()
(
seltrackscount=CountSelectedTracks(0);
w=0;

loop(seltrackscount,
track = GetSelectedTrack(0, w);
name = GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name, 0);
len=strlen(#current_track_name);

while (str_getchar(#current_track_name, len, c) != 35) // count down from end to find "#" char.
  (
  len=len-1; // count down from end

  );

///
w=w+1;
len>=0 ? sharpsymbol=1;
len<0 ? sharpsymbol=0;
sharpsymbol==0 ? (

strncat(#current_track_name," #1",999);
GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name, 1);
);
);
//////////////////////////////////////////////////////////////////////
);//end func add_n1

function changetracknamenumber()
(
i=0;
loop(seltrackscount,
name = GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name2, 0);
len=strlen(#current_track_name);
while (str_getchar(#current_track_name, len, c) != 35) // count down from end to find "#" char.
  (
  len=len-1; // count down from end

  );
len>=0 ? sharpsymbol=1;
sharpsymbol==1 ? (

//Change track name number

seltrackscount=CountSelectedTracks(0);

track = GetSelectedTrack(0, i);
name = GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name, 0);
len0=strlen(#current_track_name);
len1=strlen(#current_track_name);
while (str_getchar(#current_track_name, len1, c) != 35) // count down from end to find "#" char.
  (
  len1=len1-1; // count down from end

  );
countdigits=len0-len1-1;

//convert count of digits into string
sprintf(#strcd, "%d", countdigits);
getchard=str_getchar(#strcd,0,c);

//expresion for find
  #gettracknum="%0s*%0s";
  str_setchar(#gettracknum,5,getchard,c);
  match(#gettracknum, #current_track_name, LTS_n1, #tracknum_str);
//convert stringtracknum to int
  match("%d", #tracknum_str, tracknum_d );
//tracknamenumber+1
  tracknum_d=tracknum_d+1;
//convert trackname_num to string
  sprintf(#newtracknum, "%d", tracknum_d);

//cut track num
  str_setlen(#current_track_name,len1+1);

  strncat(#current_track_name,#newtracknum,999);
  GetSetMediaTrackInfo_String(track, "P_NAME", #current_track_name, 1);
);
i=i+1;
);
);
///////////////////////////////////
namebyvstiname();
duplicatetracks();
renameemptytrack();
add_n1();
changetracknamenumber();
 
Последнее редактирование:

Сейчас просматривают