PFind

Searches for the first instance of the specified text in the selected range, the active story, or all stories of the current publication. Selects the first match it finds.


Command constructor

PFind(const char * sFindWhat, short cSearchRange, PMBool bWrapAround, PMBool bMatchCase = false, PMBool bWholeWord = false, PMBool bClearAttr = false);
const char * sFindWhat;
Text to search for.
short cSearchRange;
kFCSSelectedText to search selected text
kFCSCurrentStory to search current story only, starting from position of insertion point (default setting)
kFCSAllStories to search all stories in current publication, starting from beginning of currently active story
kParmDefault to use default or previously defined range
kParmDontCare to let system choose range based on current text selection. If text is selected, the PFind command searches only selected text; if no text is selected, the PFind command searches current story only, starting from position of insertion point.
PMBool bWrapAround;
false to stop searching when PageMaker reaches end of story
true to continue searching from beginning of story when PageMaker reaches end of story
PMBool bMatchCase;
false to turn off case-sensitive searching (default setting)
true to turn on case-sensitive searching (match capitalization of search text exactly)
PMBool bWholeWord;
false to search for any occurrence of specified text (default setting), even if text is found within another word (for example, searching for "story" could yield "history,"as well as "story")
true to search for specified text as a whole word only, disregarding cases where text is embedded within another word.
PMBool bClearAttr;
false to use existing Find text and paragraph attributes (default setting)
true to clear all Find attribute settings
Story editor only. The PFind command works only in story editor.

Current publication only. Unlike the Find dialog box, the PFind command cannot search multiple publications. It can search only the stories in the cur rently active publication.

Find next. The PFind command locates of the search text. You must repeat the command or use the PFindNext command to find the next occurrence of the search text.

bWrapAround. PageMaker disregards the bWrapAround parameter when cSearchRange is set to either:

Optional parameters. PageMaker requires only the sFindWhat parameter. If you do not include values for the other parameters, PageMaker uses the set tings of the last PFind, PChange, or PChangeAll command. (If none of these commands has been executed this session, PageMaker uses the default settingsnoted in the parameter list above.)

Setting text and paragraph attributes. To search for text and paragraph attributes (e.g., font, type size, paragraph style), use the PFindTypeAttr1, PFindTypeAttr2, and PFindParaAttr commands, followed by the PFind command with bClearAttr set to useattributes or 0.

Searching for text attributes only. To search for text attributes only (e.g., all 10 point, bold text), first use the PFindTypeAttr1 and PFindTypeAttr2 commands to set the desired attributes. (Be sure to clear the paragraph attributes with the PFindParaAttr command.) Then, follow with the PFind command: Specify an empty string for sFindWhat and set bClearAttr to useattributes or 0. For example, to search for all 10-point, bold text in a publication, the commands are:

PFindTypeAttr2(-3, -3, "Any", -3); // to clear the other type attributes
PFindParaAttr("Any", -3, -3);
// to clear the paragraph attributes
PFindTypeAttr1("Any", 10, -3, boldstyle, -3, -3);
PFind("", "", kFCSAllStories, false);
// last 3 params use default

Searching for special characters. You enter a special character as part of your search text using the same key combinations that you use to enter the character directly into the Find dialog box. Refer to Adobe PageMaker 6.5 Help > Shortcuts > Special Characters.

Scripts palette. Do not use the PFind command in scripts you plan to run using the Scripts palette. When PageMaker finds no match or completes the search, the Scripts palette interprets this as an error and stops at that point in the script.

Exceptions. If no match found or search is complete, the constructor throws a CQ_SEARCH_STATUS exception. If the Story editor is not active, it throws a CQ_LO_INVALID_MODE exception.

Example. The following example searches the current story for any instance of the letters "tango," regardless of the capitalization or attribute settings (paragraph style, font, size, type style, position, or case). The search begins at the position of the insertion point and wraps to the beginning of the story if neces sary.

PFind("tango", kFCSCurrentStory, true, false, false, true);


See also

The PChange, PChangeAll, PChangeNext, PChangeParaAttr, PChangeTypeAttr1, PChangeTypeAttr2, PChangeWindow, PFindNext, PFindParaAttr, PFindTypeAttr1, PFindTypeAttr2, and PFindWindow commands

The PGetChangeParaAttr, PGetChangeTypeAttr1, PGetChangeTypeAttr2, PGetChangeWindow, PGetFindParaAttr, PGetFindTypeAttr1, PGetFindTypeAttr2, and PGetFindWindow queries

Adobe PageMaker 6.5 Help > Commands > Utilities > Find

Adobe PageMaker 6.5 Help > Shortcuts > Special Characters


Copyright © 1996, Adobe Systems Incorporated. All rights reserved.

Comments or suggestions? Contact Adobe Developer Support