Searches for a pattern within a given selection. This method returns the offset of the matched pattern. To continue searching, call this method again, adjusting StartFrom field appropriately. If pattern is not found in the specified range, -1 is returned. Complexity: linear-time, depending on the file's size and selection's complexity.
This method is a replacement for IFileDocument.Find when used in scripting languages.
Searching for a pattern
var fdoc = new ActiveXObject("FileDocument.FileDocument");
var msec = fdoc.CreateEmptySelection();
fdoc.Open("c:\\temp\\file.txt");
msec.AddRange(0, fdoc.FileSize); // We'll be searching in a whole file
var pattern = fdoc.CreateSequence();
pattern.AddData(HexBytes, 0x0d, 0x0a); // EOL pattern
var EOL_Offset = fdoc.ToNumber(fdoc.FindS(pattern, msel, 0, false, false));
// ...
// continue searching
EOL_Offset = fdoc.ToNumber(fdoc.FindS(pattern, msel, EOL_Offset + 1, false, false));