Article ID: 192105
Article Last Modified on 7/1/2004
CREATE TABLE ProjInf (DirName c(10), extName c(3))
INSERT INTO ProjInf VALUES ('data','dbc')
INSERT INTO ProjInf VALUES ('data','dbf')
INSERT INTO ProjInf VALUES ('forms','scx')
INSERT INTO ProjInf VALUES ('reports','frx')
INSERT INTO ProjInf VALUES ('classes','vcx')
INSERT INTO ProjInf VALUES ('prgs', 'prg')
Save the table to the project directory. The table fields can be changed
to reflect the project directory tree and the type of files in the
respective sub-directories.
********Top of Code********
***************************
#DEFINE PROJROOT 'c:\myproj' && Specify Project root directory.
&& The preceding can be changed to reflect the actual root directory.
SET DEFAULT TO PROJROOT && Select Project root directory.
defdir = SYS(5) + CURDIR() && Save Project directory information.
CREATE PROJECT myproj NOSHOW NOWAIT && Create the project.
curProj=_VFP.ACTIVEPROJECT && Get ActiveProject Object reference.
use ProjInf && Open Table with directory and extension information.
scan && Scan the table.
AddFile(defDir, DirName,extName) && Add files.
endscan
**Set the Main program.
msgrtrn=messagebox("Select the Main Project File",4)
if msgrtrn=6
curProj.SETMAIN(getfile( "*","File Name","Select",1,;
"Select Main File"))
endif
curProj.CLOSE
**Function that adds files to the project.
FUNCTION addfile
PARAMETERS dDir, fDir, fExt
SET DEFAULT TO (dDir+fDir) && Select the file directory.
DirStat = ADIR(dAry,'*.'+fExt) && Get all files in directory.
IF DirStat != 0
FOR i = 1 TO ALEN(dAry,1)
curProj.FILES.ADD(dAry(i,1)) && Add files to Project.
ENDFOR
ELSE
WAIT WIND fext+"Specified Files Not in "+;
(upper(fDir)+" Directory"
ENDIF
SET DEFAULT TO (dDir) && Select Project directory.
RETURN
********End of Code********
***************************
Additional query words: kbVFp600 kbProjManager
Keywords: kbhowto kbcode KB192105