Eric Selje
¿ªÔÆÌåÓýOooh, I have a good one for this.? I did it some time ago and may have even shown you before, but it's been so useful to me that I think it's worth revisiting.
?
If you've ever typed SELE (space) at the command line, you know that you get the syntax for SQL - Select statements.? This is fine sometimes, but what if you really wanted the SELECT [workarea] syntax?? Well, who would really want that, because it's so simple?? Wouldn't it actually be very cool if it presented you with a list of open tables to choose from?? (Believe me, it is).?? And, as an added bonus, if there were no tables open it automatically changes itself to USE so you can open the table you're looking for.
?
Here's what you do to get this:
?
1. Open Intellisense Manager, and change to the "Custom" tab.
2. In the box that says "Replace", type opentables, change the Type to "Script," then click "Add."? This adds a new script record to the FoxCode table.? Click "Script" to edit this script, and paste this code:
?
LPARAMETER oFoxCode
?
LOCAL X, cReturn, nUsed
?
* Create array of open tables
nUsed =AUSED(aTables) ?
IF nUsed? = 0
??* Return a value ?oFoxCode.valueType = 'V' ?cReturn =? 'USE ~' ELSE ?* Tell IntelliSense that you want a dropdown list to appear ? oFoxCode.valueType = 'L' ?* Build the list using oFoxCode's built in properties ?DIMENSION oFoxcode.Items[m.nUsed,2] ?FOR i = 1 TO m.nUsed ??oFoxcode.Items[m.i,1] = aTables[i, 1] ??oFoxcode.Items[m.i,2] = "" ?ENDFOR ?* Return the prefix for the results of the list ?cReturn = "SELECT" ENDIF * Return either USE or SELECT RETURN cReturn ?
3 . Save that script (Ctrl+W), then add a new record to FoxCode by typing SEL in the Replace box, changing the type to "Command", and click "Add."
?
4. To make it so that SEL invokes our opentables script, click "Edit", and type {opentables}?? in the Cmd field.?
?
5. Click Ok and you should be all set.? Good luck!
?
Even though it ends up being very simple, it actually took me about an hour to figure out how to do this all over again tonight.
?
Enjoy,
?
Eric
?
|