INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Utility Program

All methods & Events Code in a Project. by ramani
Posted: 4 Nov 03

*********************************************************
** Author : Ramani (Subramanian.G)
**          FoxAcc Software / Winners Software
**          ramani_g@yahoo.com
** Type   : Copyrights reserved.
**          Freeware for non commercial use
** Warranty : Nothing implied or explicit
** Last modified : 04 November, 2003
*********************************************************
** Programe frmCode
** Category : Development Tool
** This program will write all methods from all forms
*    and classes included in the open project
*    to a text file with same name as project
*********************************************************
** How to Run..
** 1. Save the following code as frmCode.PRG
** 2. Open the project
** 3. From command window type DO frmCode
** OR =FRMCODE()
*********************************************************
** PROCEDURE frmCode
*
#DEFINE CRLF chr(13)+chr(10)

LOCAL cFormFile, cAlias, cTable, cSaveError, ;
      cOutPut, cTitle, Date_time, cLine, cLine1, ;
      nFiles, nCount, nLoc
CLOSE TABLES ALL
** Collect files from project
nFiles = application.ActiveProject.Files.Count
cOutPut = application.ActiveProject.Name
cOutPut=FULLPATH(JUSTSTEM(cOutPut))+".txt"
cLine = REPLICATE("*",70)+CRLF
cLine1 = "** procedure end *"+REPLICATE("*",50)+CRLF
cTitle = "** Documentation of the forms & classes in Project: " +JUSTSTEM(cOutPut)+CRLF
date_time = "** Date/Time: "+ TTOC(DATETIME())+CRLF

*Write the headers with formTitle+date+time
STRTOFILE("",cOutput,.F.) && Wipe existing file
STRTOFILE(cTitle,cOutPut,.T.)
STRTOFILE(date_time,cOutPut,.T.)
STRTOFILE(cLine,cOutPut,.T.)
STRTOFILE(CRLF+CRLF+CRLF,cOutPut,.T.)
**
FOR i =  1 TO nFiles
    cFormFile = application.ActiveProject.Files(i).NAME
    IF UPPER(JUSTEXT(cFormFile)) $ "SCX,VCX"
       ** Now we can actually start
       cTable=JUSTSTEM(cFormFile)
       cAlias="_"+JUSTSTEM(cFormFile)
       nCount = 1
       USE (cFormFile) IN 0 ALIAS (cALias)
       SELECT (cAlias)
       ** Create a sub-title for the form or class
       cTitle = IIF(UPPER(JUSTEXT(cFormFile))="SCX","Form","Class")
       cTitle = "** "+cTitle+" : "+cTable+CRLF
       STRTOFILE(cTitle,cOutPut,.T.)
       STRTOFILE(cLine,cOutPut,.T.)
       **
       SCAN
          * Look for Methods
          DO WHILE .t.
             nLoc=AT("PROCEDURE",UPPER(methods), nCount)
             IF nLoc>0
                cTemp=SUBSTR(methods,nLoc)
                cTemp=LEFT(cTemp,AT("ENDPROC",cTemp)+7)
                STRTOFILE(cTable+ ;
                   " ***  "+objname+CRLF+cTemp,cOutput,.T.)
                STRTOFILE(cLine1,cOutPut,.T.)
                STRTOFILE(CRLF+CRLF+CRLF,cOutPut,.T.)
             ELSE
                EXIT
             ENDIF
             ncount = nCount+1
          ENDDO
          nCount = 1
       ENDSCAN
       STRTOFILE(cLine,cOutPut,.T.)
       STRTOFILE("** End of form procedures....: "+ ;
                 cTable+CRLF,cOutPut,.T.)
       STRTOFILE(cLine+cline+cline+cline+cline,cOutPut,.T.)
       STRTOFILE(CRLF+CRLF+CRLF,cOutPut,.T.)
       USE IN (cAlias)
    ENDIF
ENDFOR
MODIFY FILE (cOutPut)
RETURN
*********************************************************
* EOF
*********************************************************

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close