Press "Enter" to skip to content

aoRenamer

[code lang="c"]
// 
// aoKit
// Andrew Odendaal's Maya Script Kit
// Software developed by Andrew Odendaal
// Code compatible with versions 7 - 8.5
//
// Author : Andrew Odendaal
// E-mail : [email protected]
// Website: http://www.andrewodendaal.com
// 

// rename items the same but increment
global proc aoKitRenameItems()
{


	string $aoKitAnswer = `promptDialog -message "Enter New Name:"
				-button "Ok"
				-button "Cancel"
				-defaultButton "Ok"
				-cancelButton "Cancel"
				-dismissString "Cancel"`;
	
	if ($aoKitAnswer == "Ok")
	{
		
		string $aoKitInputName = `promptDialog -q`;

		int $i = 0;
		string $aoKitSelected[] = `ls -sl`;
		int $g = 0;
		int $g = size($aoKitSelected[$i]);
		print ( $g + "\n" );

		for ($i = 0; $i < size($aoKitSelected[$i]); $i++) 
		{
			print ("Renamed to : " + $aoKitInputName + "#\n");
			rename $aoKitSelected[$i] $aoKitInputName;
		}
		
	}
	else
		error "Cancelled by user.";
}
[/code]