Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching through all application directory...
Message
From
18/10/2000 18:02:41
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430305
Message ID:
00431206
Views:
25
This message has been marked as a message which has helped to the initial question of the thread.
>>>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 :))
>>>
>>
>>Early AM can make writing code off the top of your head a bit harder. Especially if you don't preview the code. I guess I'll start leaving the implementation as an exercise for the reader and let you guys figure it out fr yourself; I already know how to use this stuff...
>
>Hi Ed,
>
>Thanks for this 'typo', at least I finally looked in Help :)
>BTW, how can I modify this code to put only particular line there SetFocus occurs instead of whole form's methods code?
>

Pop the Match into an array using ALINES, and then iterate through the array line by line

>>>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
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
Reply
Map
View

Click here to load this message in the networking platform