Use cParser.pkg Object oFileFinder is a cFileFinder Property String psCurrentFindText "" Property Integer phoTargetObject 0 Property Integer piMaxUseTabPages 4 Property Integer piShowAll 0 // // If the search text is very long, then we have to make it shorter for easier use in the find // panels // Function EllipseFindText String sText Returns String String sFindText Move (Trim(sText)) to sFindText If (length(sFindText) > 15) Move ( (Left(sFindText,12)) + "..." ) to sFindText Function_Return sFindText End_Function Procedure StartFileFind String sPath String sType String sText Integer bSubFolders Integer bMatchCase Integer bMatchWord Integer bShowAll Integer bRegExp Boolean bExcludeComments Set psCurrentFindText to sText Set piShowAll to bShowAll Forward Send StartFileFind sPath sType sText bSubFolders bMatchCase bMatchWord bShowAll bRegExp bExcludeComments End_Procedure // This function is a straight copy from cEditorEdit (yuck) // helper function for MarkScopeBlock, when a keyword is found in a string declaration // it will skew the scope block marking, so remove all strings Function RemoveStringsFromLine String sLine Returns String Integer iLength Integer iPos Boolean bSep1 Boolean bSep2 String sChar String sSep1 String sSep2 String sReturn Move "'" To sSep1 Move '"' To sSep2 Move "" To sReturn Move false To bSep1 Move false To bSep2 Move (length(sLine)) To iLength For iPos From 1 To iLength Move (Mid(sLine,1,iPos)) To sChar If (bSep1=false and bSep2=false) Begin If (sChar=sSep1) Move True to bSep1 Else If (sChar=sSep2) Move True To bSep2 If (bSep1=false and bSep2=false) Move (sReturn+sChar) To sReturn End Else Begin If (bSep1) Begin If (sChar=sSep1) Move false To bSep1 End Else If (bSep2) Begin If (sChar=sSep2) Move false To bSep2 End End Loop Function_Return sReturn End_Function // RemoveStringsFromLine Procedure AddLine String sLine Boolean bExcludeComments Boolean bFiltered Handle hoTargetObject Integer iPos Integer iCommentPos String sTmpLine String sFindText Move False To bFiltered Move (phoTargetObject(Self)) To hoTargetObject Get pbExcludeComments To bExcludeComments If (bExcludeComments) Begin Move (Pos(">:",sLine)) To iPos // Format of the line is "fileName.pkg:actual code" If (iPos>2) Begin Move (Mid(sLine,Length(sLine)-(iPos+1),iPos+2)) To sTmpLine End Else Begin // just in case Move sLine To sTmpLine End Move (LTrim(sTmpLine)) To sTmpLine If (Left(sTmpLine,2)='//') Begin Move True to bFiltered // we don't want to see comments in our search result so filter them. End Else Begin // the search text might still be in a comment that comes after code Get RemoveStringsFromLine sTmpLine To sTmpLine Move (Pos('//',sTmpLine)) To iCommentPos If (iCommentPos>0) Begin Get psCurrentFindText To sFindText If (Pos(sFindText,sTmpLine)>iCommentPos) Begin Move True To bFiltered End End End End If (hoTargetObject<>0 and bFiltered=false) Begin Send Add_Line To (phoTargetObject(Self)) sLine End End_Procedure Procedure CreateFindPage Integer hoObj String sDesc String sFindText If (phoTargetObject(Self)=0) Begin Get psCurrentFindText To sFindText Get EllipseFindText sFindText To sFindText #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[469], sFindText )) to sDesc #ELSE Move ("Searching:'" + sFindText + "'" ) to sDesc #ENDIF Get Add_Output_Page of ghoOutputDialog sDesc to hoObj Get Output_Area of ghoOutputDialog hoObj to hoObj Set piCombineOutput of hoObj to (piShowAll(Self)) Set phoTargetObject to hoObj End End_Procedure Procedure OnStart Send OnStartFind to (oFindFiles(Self)) If (phoTargetObject(Self)) Ne 0 Set piCanCancel of (phoTargetObject(Self)) to True End_Procedure Procedure OnFinish String sDesc String sFindText If (phoTargetObject(Self)) Begin Get psCurrentFindText To sFindText Get EllipseFindText sFindText To sFindText #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[470], sFindText )) to sDesc #ELSE Move ("Results:'" + sFindText + "'" ) to sDesc #ENDIF Set label of (parent(phoTargetObject(Self))) to sDesc End Send OnFinishFind to (oFindFiles(Self)) If (phoTargetObject(Self)) Ne 0 Set piCanCancel of (phoTargetObject(Self)) to False Set phoTargetObject to 0 End_Procedure End_Object