Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to retrieve text in command window?
Message
From
02/11/2001 08:23:33
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00576251
Message ID:
00576641
Views:
16
Thanks to all, I can do now all my tricks.
Which is, to create menubars which contain all recently used "MODIFY" commands from the command window (I use for these menu bars a menu pad which is visible only in developers mode.)

>I believe code in the following vein will do the trick:
>
>lclastwind = wontop()
>keyboard "{ctrl+f2}"+"{pause .1}"+"{ctrl+A}"+"{pause .1}"+"{ctrl+c}"+"{pause .1}"+"{ctrl+end}{pause .1}"
>activate window (lcLastWind)
>
>
>Now the contents of the command window is in _cliptext
>
>Glenn
>
>>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:
>>
>>*-- get the text from the command window
>>
>>*-- make sure FoxTools is loaded
>>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?
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform