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!

Evaluate 'DO' cmd set to variable?

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
0
0
US
I was wondering if there is a way I can evaluate a variable that is basically just a do command? Because the program that I am calling is determined by what county a file address is inI can't just type:

Do MyProg ;
***locfile...

For every county there is a different program to be called. The program name is simply the county name. Here is my code:

lcLisSTR = ALLTRIM(lcLisSTR)&&Above this line of code I sparse a string(lcLisSTR) down to the county name

lcDoProg = "DO" + " " + lcLisSTR + " " + "IN LOCFILE('ACTSYS\PROGS\az_taxassessor','PRG','Find')"

EVAL(lcDoProg)

Obviously 'eval' doesn't work here. What can I do to make this work? As always, thanks for your help!

-Kevin
 
I tried that but I get a syntax error.

-Kevin
 
Kevin,
Since LOCFILE() gives you back a fully qualified file, then you either need to trim off the file name with JUSTPATH(), or simply use GETFILE() and make sure they pick the right county.

I'm assuming that all your .PRG files have been compiled to .FXP's. Otherwise, you'll need to have all your users be running the developer edition of VFP (a potentially expensive proposition), or a new enough version of VFP to support the EXECSCRIPT( ) Function in the Runtime Environment.

Rick
 
Kevin,
It works fine for me. Chances are, the syntax error is in the string itself. Check what's exactly in your lcDoProg string and try to execute it directly from Command window.
 
I agree with Stella. Could it be that some county names have embedded blanks?

Jim
 
I'm an idiot. The website I was getting the county information from only allows so many 'free searches' before you have to register. I reached my limit, so the code that retrieved the data from the website and sparsed it for the county wasn't finding a county. In other words, lcLisSTR was returning a blank. I registered with the website and now the code works fine with:

&lcDoProg

Thank you both for your help.

I'm assuming that all your .PRG files have been compiled to .FXP's. Otherwise, you'll need to have all your users be running the developer edition of VFP (a potentially expensive proposition), or a new enough version of VFP to support the EXECSCRIPT( ) Function in the Runtime Environment.

Rick, you bring up and point here that I have been curious about. I have VFP 8, when I build the final version of my app will the .prg's work? Also, I have been reading many threads and articles about InstallShield. Everything I've read talks about adding the runtime libs. I tried packaging a test app but couldn't get it to work. I included VFPRunTime.msm but must not be doing it correctly. Am I adding the right file, and are there more?

-Kevin
 
Kevin,
No, in the runtime (even VFP 8.0), you can't run a .PRG file that isn't included in the application or doesn't have a precompiled .FXP file in the same directory as the .PRG file.

In 8.0 you can use the EXECSCRIPT( ) Function - check your help file for details.

I'm not sure what articles you've read, but you should read "INFO: Using the Most Current Merge Modules with InstallShield Express for Visual FoxPro 8.0" and the PDF file it refers to near the end.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top