How do i tell DW to run a complex Find and Replace inside the current file
ONLY via extension javascript?

I am writing a custom extension to automate some repetitive manual processing
specific to my 40,000 page site. I have a javascript file that:
- opens the document currently selected in the Site Window
- calls "setUpComplexFindReplace" to set up a complex query via XML generated
by the save query feature
- saves the document

The problem is that, no matter what i do, i cannot seem to specify the "Find
in" scope of this complexFindReplace operation. It keeps defaulting to "All
selected files", even when i specifically set it to "current document" by hand
in the Find and Replace dialog before running my command.

Halfway through my command it starts warning me that the requested operation
cannot be undone in files that are not open, and when i cancel out of my
extension's operation and open up the Find and Replace dialog, the "Find in"
scope has mysteriously changed back to "All Selected Files".

Can anyone help me out here? Is it possible to specify the "find in" scope
via setUpComplexFindReplace or through some other programmatic means?

David.