Passing command line parameters to a VFP EXE 
Author Message
 Passing command line parameters to a VFP EXE

Passing command line parameters to a VFP EXE

Hi,

I need a VFP program to be run in non-interactive mode, to receive
parameters in commandline.

So I made a simple program, without any event loop, screen invisible, etc.
The problem is when I want to receive command parameters.

I use

Parameters cPara1, cPara2, cPara3, cPara4 as first line in my program

The problem is, wgen I start the program from commandline, with parameters,
even is pcount() returns the right number of passed params, cparam1-4 are
not properly initialized (actualy they are left empty every time)

Once I received the parameters properly, but I don't know why, and this is
not happrening from that moment. I didn't any change in code meanwhile.

Can anyone help me please?

Regards,
Bogdan



Sat, 03 Jan 2004 17:47:29 GMT  
 Passing command line parameters to a VFP EXE
Bogdan,
I just checked a program that regularly uses this feature, and the only
difference that I see, is that I use:
LParameters cPara1, cPara2, cPara3, cPara4

What version and service pack of VFP are you using? (I'm using VFP 6.0 SP5.)
Are you calling any other procedures or functions before checking these
parameters. You are aware that all these parameters will be passed as a
character string - regardless the "type" on the command line.

Rick


Quote:
> Passing command line parameters to a VFP EXE

> Hi,

> I need a VFP program to be run in non-interactive mode, to receive
> parameters in commandline.

> So I made a simple program, without any event loop, screen invisible, etc.
> The problem is when I want to receive command parameters.

> I use

> Parameters cPara1, cPara2, cPara3, cPara4 as first line in my program

> The problem is, wgen I start the program from commandline, with
parameters,
> even is pcount() returns the right number of passed params, cparam1-4 are
> not properly initialized (actualy they are left empty every time)

> Once I received the parameters properly, but I don't know why, and this is
> not happrening from that moment. I didn't any change in code meanwhile.

> Can anyone help me please?

> Regards,
> Bogdan



Sat, 03 Jan 2004 20:49:44 GMT  
 Passing command line parameters to a VFP EXE
Hi,

Quote:
> I just checked a program that regularly uses this feature, and the only
> difference that I see, is that I use:
> LParameters cPara1, cPara2, cPara3, cPara4

I tried this to, and the same (bad) result!

Quote:
> What version and service pack of VFP are you using? (I'm using VFP 6.0
SP5.)
> Are you calling any other procedures or functions before checking these
> parameters. You are aware that all these parameters will be passed as a
> character string - regardless the "type" on the command line.

I'm using VFP6 SP4
I know they all are treated as strings.

I have also VS.Net (with VFP7) on the same system.
Couuld this have any bad influence?

Bogdan



Sat, 03 Jan 2004 23:07:07 GMT  
 Passing command line parameters to a VFP EXE
Bogdan,
I just recreated a simple project in both VFP 5a and VFP 6.0 SP5. It
consists of just a single program - MAIN.PRG.

* MAIN.PRG
LPARAMETERS c1Parm, c2Parm, c3Parm

IF !INLIST(TYPE('c1Parm'), "U", "L")
 Wait WINDOW IIF(TYPE('c1Parm') = "C", c1Parm, STR(c1Parm))
ENDIF

IF !INLIST(TYPE('c2Parm'), "U", "L")
 wait window IIF(TYPE('c2Parm') = "C", c2Parm, STR(c2Parm))
ENDIF

IF !INLIST(TYPE('c3Parm'), "U", "L")
 wait window IIF(TYPE('c3Parm') = "C", c3Parm, STR(c3Parm))
ENDIF

RETURN

Notes: The INLIST() check for "L" is needed for both VFP 6.0 runtime and
when run in the development environment where missing parameters are typed
"L". (For the VFP 5 runtime, missing parameters  are typed "U".) The
IIF(TYPE()) in the WAIT WINDOW is strictly for non-runtime testing.

I then ran the .EXEs multiple times with 0 -> 3 parameters, and both 5 and 6
versions worked as expected.
ex.
f:\vfp50\testparm.exe 1                      && one parameter
f:\vfp50\testparm.exe 1 2 XYZ          && three parameters
f:\vfp50\testparm.exe 1 "2 XYZ"        && two parameters
f:\vfp60\testparm.exe 99 "2 - XYZ"   && two parameters
f:\vfp60\testparm.exe                         && zero parameters

Rick


Quote:
> Hi,

> > I just checked a program that regularly uses this feature, and the only
> > difference that I see, is that I use:
> > LParameters cPara1, cPara2, cPara3, cPara4

> I tried this to, and the same (bad) result!

> > What version and service pack of VFP are you using? (I'm using VFP 6.0
> SP5.)
> > Are you calling any other procedures or functions before checking these
> > parameters. You are aware that all these parameters will be passed as a
> > character string - regardless the "type" on the command line.

> I'm using VFP6 SP4
> I know they all are treated as strings.

> I have also VS.Net (with VFP7) on the same system.
> Couuld this have any bad influence?

> Bogdan



Sun, 04 Jan 2004 22:08:31 GMT  
 Passing command line parameters to a VFP EXE
did you call your program?
in DOS, yuo don't use comma to separate the parameters.
Quote:
> I use
> Parameters cPara1, cPara2, cPara3, cPara4 as first line in my program
> The problem is, wgen I start the program from commandline, with parameters,
> even is pcount() returns the right number of passed params, cparam1-4 are
> not properly initialized (actualy they are left empty every time)



Mon, 05 Jan 2004 11:46:04 GMT  
 Passing command line parameters to a VFP EXE
Thank you all.
I finally solved the problem.

I was stupid.
I discovered I had a CLEAR ALL just before all starts, so it clears my
parameters.
My fault! :-)

Regards,
Bogdan


Quote:
> Passing command line parameters to a VFP EXE

> Hi,

> I need a VFP program to be run in non-interactive mode, to receive
> parameters in commandline.

> So I made a simple program, without any event loop, screen invisible, etc.
> The problem is when I want to receive command parameters.

> I use

> Parameters cPara1, cPara2, cPara3, cPara4 as first line in my program

> The problem is, wgen I start the program from commandline, with
parameters,
> even is pcount() returns the right number of passed params, cparam1-4 are
> not properly initialized (actualy they are left empty every time)

> Once I received the parameters properly, but I don't know why, and this is
> not happrening from that moment. I didn't any change in code meanwhile.

> Can anyone help me please?

> Regards,
> Bogdan



Wed, 07 Jan 2004 15:29:58 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Passing command line parameters project EXE

2. Passing parameter to VFP on Command Line

3. How are command line parameters passed/used?

4. Parameters passed to a VFP exe

5. Generate VFP 3 command line exe

6. Command line arguments for VFP.exe without prg...

7. ! /N RUN command parameter passing

8. vfp6 command line parameters???

9. Command line parameters

10. Frustrated by command line parameters in visual foxpro 5

11. Foxpro 2.6 Debugger, Starting with Command Line Parameters

12. Command Line parameters

 

 
Powered by phpBB® Forum Software