Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
At first glance, ASSIST is a totally useless command; it appears to do nothing. In fact, ASSIST and _ASSIST are a set of very useful hooks that can give you quick access to whatever you’d like.
ASSIST
_ASSIST = cFileName
ASSIST and _ASSIST were added in FoxPro 2.6 for dBASE compatibility. They provided access to the Catalog Manager. Well, CatMan’s gone in Visual FoxPro. The enhanced Project Manager includes the functionality of both the old Project Manager and Catalog Manager.
So what good are ASSIST and _ASSIST? Like many other system variables, _ASSIST lets you specify a program to run under particular circumstances—in this case, when the ASSIST command executes. The key is that it can be any program at all, and unlike other such variables (say, _GENMENU), there’s no built-in time when _ASSIST is executed. It only runs when you tell it by issuing ASSIST.
For instance, we have several files (tables and text) we need to open each time we start to work on this book. But we’re also using VFP for testing as we go. So, it’s really handy to have a program that opens all the files we need and sets them up the way we want. By hooking this program to _ASSIST, resetting things is as simple as issuing ASSIST. Using a system variable means the setting doesn’t go away when we issue CLEAR ALL
to clean up from some disaster.
_ASSIST = "HackSet.PRG"
ASSIST && runs the program