i use following macros to Prefix or Suffix any selected entity in powermill explorer, except for folders.
I've bound em to [control + y] and [shift + control + y]
Prefix:
entity LIST $input = explorer_selected_entities()
if size($input) <= 0 {
return
}
string $prefix = input "Prefix"
if $prefix == ' ' {
return
}
foreach $et in $input {
string $newName = $prefix + $et.Name
string $tempName = $newName
int $i = 1
while entity_exists($et.RootType, $newName) {
$newName = $tempName + '_' + $i
$i = $i + 1
}
string $cmd = "Rename " + et.RootType + ' "' + $et.Name + '" "' + $newName + '"'
DoCommand $cmd
}
Suffix:
entity LIST $input = explorer_selected_entities()
if size($input) <= 0 {
return
}
string $suffix = input "Suffix"
if $suffix == ' ' {
return
}
foreach $et in $input {
string $newName = $et.Name + $suffix
string $tempName = $newName
int $i = 1
while entity_exists($et.RootType, $newName) {
$newName = $tempName + '_' + $i
$i = $i + 1
}
string $cmd = "Rename " + et.RootType + ' "' + $et.Name + '" "' + $newName + '"'
DoCommand $cmd
}
Following macro adds a prefix and an increasing number to the name:
entity LIST $input = explorer_selected_entities()
if size($input) <= 0 {
return
}
string $prefix = input "Prefix"
if $prefix == ' ' {
return
}
int $counter = 0
foreach $et in $input {
$counter = $counter + 10
string $newName = $prefix + '_' + $counter + '_' + $et.Name
string $tempName = $newName
int $i = 1
while entity_exists($et.RootType, $newName) {
$newName = $tempName + '_' + $i
$i = $i + 1
}
string $cmd = "Rename " + et.RootType + ' "' + $et.Name + '" "' + $newName + '"'
DoCommand $cmd
}
I couldn't test it because I'm not at work...