If I use the search bar, the context for the search is the files in the current file window. (Note: I'm using the term "context" here rather than "scope", as scope is also used to refer to the metadata fields that will be searched.)
I can't see a way to specify the context for a search triggered in a script, i.e. I can't see how to limit which files are searched, eg current folder, category etc, rather than the entire database. On the other hand, there are some sophisticated ways to specify the scope for the search, i.e. which fields are searched.
And I right, or have I missed something? (I read the help and the sample script carefully several times.)
If that is right, is this BBD, or is this something where you'd consider a FR?