Copy Command Window Selected Text to Clipboard Programmatically

The code uses Editor functions from Foxtools.fll. See George Tasker's Extended Foxtools Help Download #9333 on UT

for more info.

$SAMPLECODE$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22

LOCAL ARRAY laEnv [25]
SET LIBRARY TO FoxTools ADDITIVE
* Get the whandle for the current window
lnHandle = _WonTop()
lnResult = _EdGetEnv( lnHandle, @laEnv )
* [ 17 ] SelStart
* [ 18 ] SelEnd
* [ 25 ] Editor Session:  0 - Command Window

IF ( lnResult = 0 ) OR ( laEnv[17] = 0 ) OR ( laEnv[25] <> 0 )
  _CLIPTEXT = ""
  RETURN
ENDIF

* Get the current cursor position
lnSelStart = laEnv[17] 
lnSelEnd = laEnv[18] 
* Store result into clipboard
_CLIPTEXT = _EdGetStr( lnHandle, lnSelStart, lnSelEnd-1 )

Comments