[REBOL] Re: Capturing output from 'help
From: dockimbel::free::fr at: 31-Jul-2001 12:06
Hi Tim,
I think you'll find the following code usefull :
---------------------------------------
REBOL [
Title: "Console capture"
Author: "Nenad Rakocevic"
Email: [dockimbel--free--fr]
Date: 31-Jul-2001
File: %capture.r
Version: 1.0.0
]
ctx-console-capture: context [
out: none
sys-print: get in system/words 'print
sys-prin: get in system/words 'prin
set 'get-captured does [out]
print-out: func [value][append out reform [reduce value newline]]
prin-out: func [value][append out reform value]
set 'capture func [flag [logic!]][
either flag [
out: make string! 1024
set 'print :print-out
set 'prin :prin-out
][
set 'print :sys-print
set 'prin :sys-prin
]
]
]
---------------------------------------
>> do %capture.r
>> capture on
>> help next
>> capture off
>> print get-captured
USAGE:
NEXT series
DESCRIPTION:
Returns the series at its next position.
NEXT is an action value.
ARGUMENTS:
series -- (Type: series port)
HTH,
DocKimbel.
Tim Johnson wrote: