Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Playblast mel script - help on file path please

Playblast mel script - help on file path please

magillaGuerilla
Collaborator Collaborator
438 Views
2 Replies
Message 1 of 3

Playblast mel script - help on file path please

magillaGuerilla
Collaborator
Collaborator

This is the mel

string $blastPath = "R:/Maya/RED_111_VFX/Blocking/RED_111_160_VFX/";

string $path = `file -q -sn`;

string $basename = basename($path, ".mb");

playblast -format qt -filename ($blastPath + $basename + ".mov") -forceOverwrite -sequenceTime 0 -clearCache 1 -viewer 1 -showOrnaments 1 -fp 4 -percent 100 -compression "Photo - JPEG" -quality 100 -widthHeight 2048 1080;

I would like to update the text in green derived from the basename/file name. 

Using
string $blastPath = "R:/Maya/RED_111_VFX/Blocking/" + $basename + "_VFX/";
returns this
// Result: R:/Maya/RED_111_VFX/Blocking/RED_111_160_BLK_001_VFX/
How can I concatenate to remove the green text (BLK and version number)?


any help much appreciated,
Cam

0 Likes
Accepted solutions (1)
439 Views
2 Replies
Replies (2)
Message 2 of 3

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

given that this part of your string will always be in the same position in your filename (after the second to last "_" and the last "_"), you should be able to do it like this:

string $path = `file -q -sn`;

string $basename = basename($path, ".mb");

string $tkn[];
tokenize $basename "_" $tkn;
int $tks = `size($tkn)`;
string $reduceName = $tkn[0];
for ($i= 1; $i < ($tks-2); ++$i){

    $reduceName = $reduceName + "_" + $tkn[$i];
    
}
string $blastPath = "R:/Maya/RED_111_VFX/Blocking/" + $reduceName + "_VFX/";

 

I hope it helps!

 

Message 3 of 3

magillaGuerilla
Collaborator
Collaborator

Awesome, thank you Kahylan

0 Likes