xsharp.eu • cmd with FoxPro
Page 1 of 1

cmd with FoxPro

Posted: Sat Jun 12, 2021 12:03 pm
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?

cmd with FoxPro

Posted: Sun Jun 13, 2021 1:34 pm
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

cmd with FoxPro

Posted: Tue Jun 15, 2021 4:21 pm
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

cmd with FoxPro

Posted: Thu Jun 17, 2021 12:38 pm
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.

cmd with FoxPro

Posted: Thu Jun 17, 2021 3:55 pm
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.

cmd with FoxPro

Posted: Thu Jun 17, 2021 5:18 pm
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....

cmd with FoxPro

Posted: Sun Jun 20, 2021 12:06 pm
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