Hello Chuck,
I'm very sorry for being so late in reply.
I don't keep the original macro but I think the following will do the job.
Kino
--
### Reverse Names ###
# Works on non-contiguously selected text portions.
$doc = Document.active
if $doc == undefined
exit 'No open document, exiting...'
end
$sels = $doc.textSelections
if ! $sels.firstValue.length
exit 'Select "Thad Jones" or "Jones, Thad" before running the macro, exiting...'
end
foreach $sel in reversed $sels
$converted = undefined
$converted = $sel.subtext.findAndReplace '^(\p{Upper}[^,]+),\x20(\p{Upper}[^,]+)$', '\2\x20\1', 'E-i'
if ! $converted
$converted = $sel.subtext.findAndReplace '^(\p{Upper}[^,]+)\x20(\p{Upper}[\S&&[^,]]+)$', '\2,\x20\1', 'E-i'
end
if $converted
$sel.text.replaceInRange $sel.range, $converted.subtext
end
end
### end of macro ###
On 2011-09-22 [+0900 JST], at 6:55 AM, Chuck Suber wrote:
> With all the updating, I've lost the macro that reverses names.
> I want to change: *Jones, Thad *to* Thad Jones*
> and to change: *Thad Jones* to *Jones, Thad*
> *
> *
> Thank you one and all. — Chuck
> *
> *
> --
> Chuck (a.k.a. Charles) Suber
> Charles Suber & Associates, Inc.
> 1750 St. Charles Ave. #607
> New Orleans, LA 70130
> voice 504-524-3087
> email [log in to unmask]
|