Christian,
AFAIK, there's no way to get the text of the command window with standard VFP code. As you've noticed, the command window is not available when you run a program and/or macro. The only workaround I found is to use the editor functions from FoxTools. I used something like the following to log the content of the command window to a table before VFP7:
IF NOT "FOXTOOLS" $ SET("LIBRARY")
IF FILE("FOXTOOLS.FLL")
SET LIBRARY TO FOXTOOLS ADDITIVE
ELSE
MESSAGEBOX("Cannot find FoxTools.fll. Cannot log command window", 16)
RETURN ""
ENDIF
ENDIF
lnWhandle = _WFindTitl("Command")
IF lnWhandle = 0
MESSAGEBOX("_WFindTitl returned 0. Cannot log command window", 16)
RETURN ""
ENDIF
DIMENSION laEnvironment[25]
IF _EdGetEnv(lnWhandle, @laEnvironment) = 0
MESSAGEBOX("_EdGetEnv failed. Cannot log command window", 16)
RETURN ""
ENDIF
lcCommandHistory = _EdGetStr(lnWhandle, 0, laEnvironment[2])
RETURN lcCommandHistory
George Tasker has created an excellent help file for FoxTools that covers functions that are not documented in the standard FoxTools help. I believe you can find it in the download section.
HTH
>Hello,
>
>I try to get the text that I have typed in the command window because I want to use it for several development tools.
>I know that when I quit VFP, the text that I typed into the command window will be stored to the file _Command.PRG. But until I quit, the text is not stored in any file I found so far. There are some temporary files in the windows temp directory but they are all locked while VFP is open.
>
>I also tried something like this:
>KEYBOARD "{SHIFT+UPARROW}"
>KEYBOARD "{SHIFT+UPARROW}"
>KEYBOARD "{SHIFT+UPARROW}"
>
>and then, smart as I am:
>KEYBOARD "{CTRL+C}"
>
>But this won't copy the highlighted text.
>
>Is there another way, or shall I just forget about it?
Daniel