Go to: Synopsis. Return value. MEL examples.

Synopsis

string[] executeForEachObject( string $inThisList[], string $thisCmd )

This procedure takes a list of object names and applies the command in "thisCmd" to each object. The object name is substituted for a %s in the command.

Return value

None

Arguments

Variable Name Variable Type Description
$inThisListstring[]- a list of object names to operate on
$thisCmdstring- a string with %s in it.

MEL examples

  // Example 1. if "thisCmd" is a string that looks like:

          string $thisCmd = "reverseCommand -ch off -rpo on %s";
  // and curve1 and curve2 are in the given list, then the commands 

  // that will be executed for each object will look like:

          reverseCommand -ch off -rpo on curve1;
          reverseCommand -ch off -rpo on curve2;

  // Example 2.  if "thisCmd" is a string that looks like:

          string $thisCmd = "reverseProc( true, false, %s )";
  // and curve1 and curve2 are in the given list, then the commands 

  // that will be executed for each object will look like:

          reverseProc( true, false, "curve1" );
          reverseProc( true, false, "curve2" );

  // Example 3.

          cone; sphere; select -all;
          string $cmd = "duplicate %s";
          string $itemList[] = `ls -sl`;
          select -d;
          string $results[] = executeForEachObject($itemList, $cmd);