While learning how to get counts for actions performed, I received some assistance at WPUniverse in this thread. Here is my macro for male-to-female search and replace. Simply reverse the information for a female-to-male scenario, rename and save.
Application (WordPerfect; "WordPerfect"; Default!; "EN")
QuickmarkSet () // Temporary Quickmark
vCount:=0
PosPageTop()
SearchCaseSensitive (Yes!)
search[] = {
" male ";
" He ";
" His ";
" he ";
" his ";
" gentleman ";
" man "
}
ReplaceWithCase (Yes!)
replace[] = {
" female ";
" She ";
" Her ";
" she ";
" her ";
" lady ";
" woman "
}
If(search[0] <> replace[0])
MessageBox(;"Error"; "Search and Replace arrays do not match - macro quits")
Return
EndIf
Declare changed[search[0]]
OnNotfound(alldone)
ForNext(i; 1; search[0]; 1)
PosDocTop
changed[i] = 0
While(True)
SearchString (search[i])
ReplaceString (replace[i])
SearchNext
ReplaceCurrent
changed[i] = changed[i] + 1
vCount := vCount + 1
EndWhile
alldone:
EndFor
QuickmarkFind() // Return to the original place in the doc
BookmarkDelete("QuickMark") // Remove the temporary Quickmark
Display(On!)
vMsg = ""
ForNext(i; 1; search[0]; 1)
vMsg = vMsg + search[i] + " was replaced " + changed[i] + " time/s" + NtoC(HRt!)
EndFor
vMsg = vMsg + NtoC(HRt!) + " A total of " + vCount+ " replaces performed in this document."
Messagebox(;"Finished";vMsg)
Return