Ah yes, sorry. I guess my script wouldn't work in that situation.
The only other thing I could offer is a loop that would open your scenes, apply your script, then save them. When you run it it will open a dialog to choose your scene files, it will keep opening the dialog until you hit cancel. It does this so that you can grab scenes from multiple directories.
Test this on some sample scenes first because the way it is set it will save your scene once the script runs, NOT save as. Also this was written on a mac, but I think all the syntax works on a PC as well. Hope it helps.
//================================================================================
// Get Multiple Scene File Paths
//================================================================================
global proc string[] DD_getMultiScene(){
string $scenes[];
string $RenderDirectory = `workspace -q -fullName`;
string $filter = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb)";
int $size = 1;
//Loop dialog until user cancels
while($size > 0){
string $getSceneFile[] = `fileDialog2 -fileMode 4 -dialogStyle 1 -dir $RenderDirectory -fileFilter $filter`;
$size = (size($getSceneFile));
$RenderDirectory = dirname($getSceneFile[0]);
for($i=0;$i<$size;$i++){$scenes[size($scenes)] = $getSceneFile[$i];}
}
return $scenes;
}
//================================================================================
// Open Scene, Execute script, save
//================================================================================
global proc DD_openApplySave(){
string $scenes[] = DD_getMultiScene();
//Progress Window
int $amount = 0;
progressWindow
-title "Multi-Scene Apply"
-progress $amount
-status "Progress: 0%"
-isInterruptable true;
//For each Scene
int $size = `size($scenes)`;
float $den = $size;
for($i=0;$i<$size;$i++){
// Check if the dialog has been cancelled
if(`progressWindow -query -isCancelled`){break;}
//Open File
file -f -options "v=0;" -ignoreVersion -o $scenes[$i];
//Execute Mel Script
loadAllRefs();
//Progress
float $num = ($i+1);
$amount = ($num/$den)*100;
//Save File
file -save;
//Edit Progress Window
progressWindow -edit
-title $scenes[$i]
-progress $amount
-status ("Progress: "+$amount+"%");
}
progressWindow -endProgress;
}
//================================================================================
// Load all refs
//================================================================================
global proc loadAllRefs(){
//Create a list of all references in the scene
string $allRefs[] = `file -q -r`;
for($ref in $allRefs){
//Find the reference node of the reference
string $refNode = `referenceQuery -referenceNode $ref`;
//Unload the reference
file -unloadReference $refNode;
//Load all references in all depths
file -loadReferenceDepth "all" -loadReference $refNode;
}
}
DD_openApplySave();