FindInFiles in PyPn script

Discussion Forums discussion FindInFiles in PyPn script

This topic contains 1 reply, has 2 voices, and was last updated by  simon 1 year ago.

Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
Author Posts
September 11, 2013 at 8:14 am #20002


I’d like like to have functionality like provided by FindInFiles dialog.
Namely would like to specify
- “Find what”
- “Find where”
- “File types”
- “Search sub directories”
directly from script and as result get “Find Results”
window populated with search resuls.

Wondering if such functionality is available.
So far, was looking at the documentation of pn module, but did no find a method which could be used for my purposes.

Class SearchOptions seems to be what should be used to specify settings for searching in multiple files. e.g. it contains
- FileExts
- Recurse
- SearchPath

However, only IDocument has interfaces for searching….
Would expect to have smth like
import pn
from pypn.decorators import script

@script(“Grep my sources”, “MyScripts”)
def Grep_MySources():
OpenSelectionFile( PyPnCommon.get_RX_Main_Path() )
SearchOptions myOptions = SearchOptions ()
myOptions.FindText=”my string”
pn.FindInFiles(myOptions )

Any ideas ?

Thanks in advance!

September 12, 2013 at 1:52 pm #20004

Key Master

Currently this is not supported in PyPN, though it is supported in the extensions interface so it should be a matter of about 4-5 lines of code to add. Perhaps in a future release!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.