Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching through all application directory...
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430305
Message ID:
00430691
Views:
29
This message has been marked as a message which has helped to the initial question of the thread.
>Cool!
>
>>>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.
>>
>>Use Adir to get every SCX file, do a MODI FILE NOWAIT on all files found, then do an aSelObj(aA, 1) and this will tell youf is SetFOcus() is in the Init method:
>>
>>?'SetFocus()' $ aA[1].ReadMethod('init')

Another approach, similar but manipulating this a bit differently, uses this logic. I've denoted sections of pseudocode in red to let you know where you've gotta come up with your own code:
oReg = CREATEOBJ('VBScript.RegExp')
oReg.Global = .t.
oReg.IgnoreCase = .t.
oReg.Pattern = 'PROCEDURE INIT([^\0]*)ENDPROC'
#DEFINE CRLF CHR(13)+CHR(10)
cInitsWithSetFocus = ''
FOR Each cFormSubDirPath IN all app's directory tree
   cStartDir = FULLPATH(CURDIR())
   CD (cFormSubDirPath)
   DIMENSION aSCXFiles[1,5]
   nForms = ADIR(aSCXFiles,'*.SCX')
   FOR i = 1 TO nForms
      USE (aSCXFiles[i,1]) AS ThisSCX
      SCAN FOR 'form' $ lower(BaseClass) AND ! EMPTY(Methods)
         oReg.Execute(ThisSCX.Methods)
         FOR EACH oMatch IN oReg.Matches
            IF 'SETFOCUS' $ UPPER(oMatch.Value)
               cInitsWithSetFocus = cInitsWithSetFocus + cFormSubDirPath + ' ' + ;
                                    aSCXFiles[i,1] + ': ' +ThisSCX.ObjName + CRLF + ;
                                    oMatch.Value + CRLF + CRLF
            ENDIF
         ENDFOR && each match
      ENDSCAN  && each form rec in SCX
   ENDFOR && each SCX
   USE IN ThisSCX
ENDFOR && each app dir
   CD (cStartDir)
IF LEN(cInitsWithSetFocus) > 0
   =STRTOFILE(cInitsWithSetFocus,'InitsWithSetFocus.TXT')
ENDIF
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform