You may want to consider a simple solution: personalize and cascade everything you want.
Edit the following section to match your needs:
if ("$ext" LikeI "avi") >> if ("$ext" LikeI "vob")
You may also want to edit the script captions:
Code: Select all
"Rename All SRT to Match .VOB files"
and add a separator between the last entry and the new one:
Code: Select all
Rename 'b', "$newName.ENG", 'p', "$toRename"; //Rename
-
"Rename All SRT to Match .VOB files"
Even icons can turn your menu into a practical thing to deal with:
"Rename All SRT to Match .VOB files|:myco"
"Rename All SRT to Match .mp4 Files|:previewfull"
In your case, this is what it look like:
Code: Select all
"Rename All SRT to Match .avi files|:tag2"
$items = Get('CountSelected'); //Get number of items.
End $items < 2, 'You must select at least two files...'; //End if 2 items are not selected.
$report = Report("{Ext}|{Basename}|{Fullname}<crlf>", 1); //Get info for selected items.
$newName = ''; //Base name of AVI.
$toRename = ''; //List of items to rename.
$i = 0;
while ($i < $items) { //Loop through lines.
$i++;
$line = GetToken("$report", "$i", "<crlf>"); //Extract line
$ext = GetToken("$line", 1, '|'); //Extract extension from line
if ("$ext" LikeI "avi") { //If extension is avi...
$newName = GetToken("$line", 2, '|'); //Store base name as new name.
} elseif ("$ext" LikeI "srt") { //Else if extension is srt...
$toRename = "$toRename|" . GetToken("$line", 3, '|'); //Add item to list to be renamed.
}
}
End "$newName" LikeI '', 'Name of AVI file was not found...'; //End if name of AVI file was not found.
End "$toRename" LikeI '', 'No SRT files found...'; //End if no SRT files were found.
$toRename = SubStr("$toRename", 1); //Strip leading '|'.
Rename 'b', "$newName.ENG", 'p', "$toRename"; //Rename
-
"Rename All SRT to Match .VOB files|:myco"
$items = Get('CountSelected'); //Get number of items.
End $items < 2, 'You must select at least two files...'; //End if 2 items are not selected.
$report = Report("{Ext}|{Basename}|{Fullname}<crlf>", 1); //Get info for selected items.
$newName = ''; //Base name of AVI.
$toRename = ''; //List of items to rename.
$i = 0;
while ($i < $items) { //Loop through lines.
$i++;
$line = GetToken("$report", "$i", "<crlf>"); //Extract line
$ext = GetToken("$line", 1, '|'); //Extract extension from line
if ("$ext" LikeI "vob") { //If extension is avi...
$newName = GetToken("$line", 2, '|'); //Store base name as new name.
} elseif ("$ext" LikeI "srt") { //Else if extension is srt...
$toRename = "$toRename|" . GetToken("$line", 3, '|'); //Add item to list to be renamed.
}
}
End "$newName" LikeI '', 'Name of AVI file was not found...'; //End if name of AVI file was not found.
End "$toRename" LikeI '', 'No SRT files found...'; //End if no SRT files were found.
$toRename = SubStr("$toRename", 1); //Strip leading '|'.
Rename 'b', "$newName.ENG", 'p', "$toRename"; //Rename
-
"Rename All SRT to Match .mp4 Files|:previewfull"
$items = Get('CountSelected'); //Get number of items.
End $items < 2, 'You must select at least two files...'; //End if 2 items are not selected.
$report = Report("{Ext}|{Basename}|{Fullname}<crlf>", 1); //Get info for selected items.
$newName = ''; //Base name of AVI.
$toRename = ''; //List of items to rename.
$i = 0;
while ($i < $items) { //Loop through lines.
$i++;
$line = GetToken("$report", "$i", "<crlf>"); //Extract line
$ext = GetToken("$line", 1, '|'); //Extract extension from line
if ("$ext" LikeI "mp4") { //If extension is avi...
$newName = GetToken("$line", 2, '|'); //Store base name as new name.
} elseif ("$ext" LikeI "srt") { //Else if extension is srt...
$toRename = "$toRename|" . GetToken("$line", 3, '|'); //Add item to list to be renamed.
}
}
End "$newName" LikeI '', 'Name of AVI file was not found...'; //End if name of AVI file was not found.
End "$toRename" LikeI '', 'No SRT files found...'; //End if no SRT files were found.
$toRename = SubStr("$toRename", 1); //Strip leading '|'.
Rename 'b', "$newName.ENG", 'p', "$toRename"; //Rename
-
"Rename All SRT to Match .MKV files|:preview"
$items = Get('CountSelected'); //Get number of items.
End $items < 2, 'You must select at least two files...'; //End if 2 items are not selected.
$report = Report("{Ext}|{Basename}|{Fullname}<crlf>", 1); //Get info for selected items.
$newName = ''; //Base name of AVI.
$toRename = ''; //List of items to rename.
$i = 0;
while ($i < $items) { //Loop through lines.
$i++;
$line = GetToken("$report", "$i", "<crlf>"); //Extract line
$ext = GetToken("$line", 1, '|'); //Extract extension from line
if ("$ext" LikeI "mkv") { //If extension is avi...
$newName = GetToken("$line", 2, '|'); //Store base name as new name.
} elseif ("$ext" LikeI "srt") { //Else if extension is srt...
$toRename = "$toRename|" . GetToken("$line", 3, '|'); //Add item to list to be renamed.
}
}
End "$newName" LikeI '', 'Name of AVI file was not found...'; //End if name of AVI file was not found.
End "$toRename" LikeI '', 'No SRT files found...'; //End if no SRT files were found.
$toRename = SubStr("$toRename", 1); //Strip leading '|'.
Rename 'b', "$newName.ENG", 'p', "$toRename"; //Rename
...of course, until something better may come out of scripters' minds...
