cmd with FoxPro

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
neewbee
Posts: 2
Joined: Sat Jun 12, 2021 11:59 am

cmd with FoxPro

Post by neewbee »

Hello there. I have a Problem and hope someone can help me. I want to open CMD from the Fox Pro programm and put in an command. This works fine with sendkey - order. But I want the result of the Order in a Variable back in VFP. How can I do this?
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

cmd with FoxPro

Post by ic2 »

Hello,
neewbee wrote:Hello there. I have a Problem and hope someone can help me. I want to open CMD from the Fox Pro programm and put in an command. This works fine with sendkey - order. But I want the result of the Order in a Variable back in VFP. How can I do this?
I do not know Foxpro but in general it is possible to start a CMD line program and get output in the Windows Clipboard. See for example this link: https://stackoverflow.com/questions/308 ... -clipboard

Another simple solution would be to save the result of your DOS program in e.g. %TEMP% as a file with a name you use to read the saved content in the Windows program.

Dick
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

cmd with FoxPro

Post by mainhatten »

neewbee wrote:Hello there. I have a Problem and hope someone can help me. I want to open CMD from the Fox Pro programm and put in an command. This works fine with sendkey - order. But I want the result of the Order in a Variable back in VFP. How can I do this?
There were a few code snippets to open a "command window" on a program even in runtime. You must search old toolboxes from nineties - vfp3 to 6 probably. Or ask on one of vfp targeting sites. You still have to anchor those in code. Might be better to restrict such use cases to those already coding in vfp and having access to developer IDE including debugger (which probably would be even better for said use case!) and not depend on runtime add-on.

my 0.02€
thomas
Bourke
Posts: 6
Joined: Mon Feb 06, 2017 1:05 pm

cmd with FoxPro

Post by Bourke »

What is an 'Order' in this scenario? A number, string, object ?

There are many ways to do this from Visual Foxpro depending on the requirement and how much control you have over the external process you want to run.

You could use Windows Scripting Host, Windows kernel CreateProcessEX ... it depends.
neewbee
Posts: 2
Joined: Sat Jun 12, 2021 11:59 am

cmd with FoxPro

Post by neewbee »

I want the answer in a String like "File mit found"
I Open cmd over FoxPro and send command with sendkey Funktion.
And dir that I Neef the answer AS a String ti Work with ir in my programa.
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

cmd with FoxPro

Post by mainhatten »

neewbee wrote:I want the answer in a String like "File mit found"
I Open cmd over FoxPro and send command with sendkey Funktion.
And dir that I Neef the answer AS a String ti Work with ir in my programa.
Google "foxpro command window runtime leafe", probably Github link to Ed's code for a foxpro command window, not a Dos/Cmd/Command window. Or just a form with a texbox to read a form.Or loop in Wait Window, build String, until CR is read....
RGreim4XS
Posts: 41
Joined: Sat Feb 08, 2020 7:47 am

cmd with FoxPro

Post by RGreim4XS »

Hi long time ago there was pocketfox, which includes also a scripting engine. To run it, it needs a VFP runtime.
Maybe it’s still there on the web.
Another good source is vfpx at github.



HTH
Rainer
Post Reply