Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

All methods & Events Code in a Project.

Utility Program

All methods & Events Code in a Project.

by  ramani  Posted    (Edited  )
*********************************************************
** 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
*********************************************************
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top