Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching through all application directory...
Message
 
 
To
18/10/2000 15:04:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430305
Message ID:
00431104
Views:
29
>>Hi everyone,
>>
>>Here is a problem:
>>I'd like to search through all applications (which are located under APPL directory in its own directories with subdirectories) and search for SetFocus() in Form's.Init.
>>
>>Is it doable other than manual?
>>
>>Thanks a lot in advance.
>
>I would check out Steven Black's Gotchas utility. It can be easily modified to drill through an application to look for specific strings. It produces a punch list of string founds and exactly where. It is a very cool piece of code.

Hi Kenneth,

Is it here in Files section? I'll take a look.

In the meantime I already created a simple program, based on Ed's idea. The only problem in the following code, that instead of particular string in Init method it prints the whole form's code. Also note, that I changed incorrect string to Matches=oReg.Execute(ThisScx.Methods) (checked Help on VBScript.RegExp - I think Ed made a little code mistake in purpose :))

Here is a program:
********************************************************************
*  Description.......: SearchScx - searches all SCX files for sSearchString in MethodToSearch
*  Calling Samples...:
*  Parameter List....: pcSearchString, pcMethodToSearch
*  Created by........: Ed Rauh
*  Modified by.......: Nadya Nosonovsky 10/18/2000 03:01:23 PM
********************************************************************
lparameters pcSearchString, pcMethodToSearch
if vartype(pcSearchString)<>'C'
     pcSearchString=upper("SetFocus")
else
     pcSearchString=upper(pcSearchString)
endif
if vartype(pcMethodToSearch)<>'C'
     pcMethodToSearch=upper("Init")
else
     pcMethodToSearch=upper(pcMethodToSearch)
endif
=GetAllFiles1('\redp\appl','scx') && Creates cursor filesADIR of all scx files
local oReg, lcTextString
oReg = createobject('VBScript.RegExp')
oReg.global = .t.
oReg.IgnoreCase = .t.
oReg.pattern = 'PROCEDURE '+pcMethodToSearch+'([^\0]*)ENDPROC'
#define CRLF chr(13)+chr(10)
lcTextString = ''
select FilesAdir && cursor with all scx files
scan
    if file(forceext(cFileName,'sct')) && Memo file is where
     use (cFileName) alias ThisSCX in 0 noupdate
     select ThisSCX
     scan for 'form' $ lower(baseclass) and ! empty(Methods)
          Matches=oReg.Execute(ThisSCX.Methods)
          for each oMatch in Matches
               if pcSearchString $ upper(oMatch.value)
                    lcTextString = lcTextString  + FilesAdir.cFileName+ ': ' +ThisSCX.ObjName + CRLF + ;
                         oMatch.value + CRLF + CRLF
                    replace flag with .t. in FilesAdir     
               endif
          endfor && each match
     endscan  && each form rec in SCX
     use in ThisSCX
     endif
     select FilesAdir && safety meassure
endscan && each app dir
if len(lcTextString) > 0
     =strtofile(lcTextString,'Result.TXT')
     modi file 'Result.TXT'
endif
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform