7

The LA Fox Developer Newsletter
January 1995
Pick a Project, Any Project
by Kelly G. Conway, Practical Business Solutions

Since I started developing in FoxPro, it seems that
I always have been working on multiple projects at
the same time. For years, I’ve had an idea that I
should write myself some sort of program that runs
when FoxPro starts up that lets me select the
project I want to work on that session. I figured I
would get it done whenever I “got around to it.”
Well, I never got around to it, so I finally decided to
sit down and write it a while back.

It turned out to be much simpler than I thought and
still is, at least to me, very useful. I thought that I
would share that tool with you this month. The
reason for sharing it is not only so that you may
make use of it (maybe you’ll find it useful for you,
maybe not), but also to give some insight into the
making of such a tool. Also, maybe someone out
there will have a better version already written and
I can learn from their ideas too.

I call my project selection utility DEV (short for
development). That reminds me to give you some
insight into the way I have my development
projects organized on my computer’s hard disk. I
have created a directory off of the root called
“DEV.” I also have created a subdirectory of DEV
for each project on which I am working. I have
contemplated a middle level which would be a
subdirectory for each client. Then all projects for a
particular client would exist in sub-directories under
the client’s subdirectory.

My biggest reason for doing this is to ease back-
ups. All I need to do to back up all of my projects
under development is backup the DEV directory
(and all sub-directories). I also find it convenient to
locate a project I have not worked on for a month
or so. Because I know that they all are located
under DEV, I can look through a shorter list of sub-
directories than I would have to if I placed all of my
projects in separate directories off of the root.

Back to DEV. DEV consists of a simple table
(DEV.DBF) and one program (DEV.PRG). The
table contains one record for each project. The
fields contained in DEV are DE_PROJ (the name
of the project), DE_CLIENT, (the name of the
client) DE_PATH (the directory path were the
project’s top-level directory is located) and DE_SETUP
(an optional program to run when I choose to work on
the project).

I have configured FoxPro so that DEV.PRG is ex-
ecuted when I start FoxPro. I did that by adding
“COMMAND=DO C:\DEV\DEV.PRG” (without the
quotes) to the CONFIG.FPW file in my FoxPro direc-
tory (e.g., C:\FPW26). It also is possible just to “DO
DEV” from the command window after FoxPro already
has started. I use that method too when I stop working
on one project and start working another.

Either way DEV is executed, it reads the records
contained in DEV.DBF and presents me with a pop-up
list of projects from which I may choose to work. I can
use the arrow keys, {PgUp} and {PgDn) (which would
indicate that I am working on far too many projects at
the same time) or {Home} and {End} to move the
highlight to the project I would like to work on. Since
the list of projects is a FoxPro popup list, I also can
type the first few letters of a project and quickly move
the highlight to that project. The list of projects displays
the DE_PROJ field mentioned above and is in alpha-
betical order.

With a project highlighted, I can press {Enter} to
indicate that I wish to work on it. I also can press {Esc)
if I wish to do something besides work on a current
project. If {Esc} is pressed, DEV simply exists, leaving
you in the default working directory for FoxPro.

If I choose a project and press {Enter}, DEV uses the
SET DEFAULT command to put me into the project
directory (as specified in the DE_PATH field of the
current record). DEV then looks to see whether I put
anything in DE_SETUP for the project. If a valid pro-
gram name is in the DE_SETUP field, DEV executes
that program. The program name that I put in
DE_SETUP typically is the program I call SETUP in
each project. That program issues all of the appropri-
ate SET commands for the project, including SET
PATH.

After DEV sets my default and runs the SETUP pro-
gram, I’m ready to work on that project. When I need
to switch over and work on another project, I just issue
“DO \DEV\DEV" in the command window and go
through the process of selecting a project again.

There are some obvious enhancements that could be
[Con't, page 8]
Page 7

7