Locates all occurrences of a given pattern within a given multiple selection. You provide the function with an output Multiple Selection object pFound, in which it stores all located ranges. This object is automatically cleared before the operation begins. When the method returns, check the IMultiSelection.Empty property to see if there were any pattern occurrences. Complexity: linear-time, depending on the file's size and selection's complexity.
This method is a replacement for IFileDocument.FindAll when used in scripting languages.
Searching all pattern occurrences
var fdoc = new ActiveXObject("FileDocument.FileDocument");
var msel = fdoc.CreateEmptySelection();
var mselOutput = fdoc.CreateEmptySelection();
fdoc.Open("c:\\temp\\file.txt");
msel.AddRange(0, fdoc.FileSize); // We'll be searching in a whole file
var pattern = fdoc.CreateSequence();
pattern.AddData(HexBytes, 0x0d, 0x0a); // EOL pattern
fdoc.FindAllS(pattern, msel, false, mselOutput);
if (!mselOutput.Empty) // check if there are any matches
fdoc.Copy(mselOutput,false); // copy them to the Clipboard