Script Library: 1218 scripts
 

capture.r

REBOL [ Title: "Console capture" Date: 31-Jul-2001 Version: 1.0.0 File: %capture.r Author: "Nenad Rakocevic" Usage: { ^->> capture on^-; activate the capture mode ^->> capture off ; get back to normal mode ^- ^-Captured output is helded in 'get-captured. ^->> print get-captured ^-} Purpose: "Capture console output in a string!" Email: %dockimbel--free--fr library: [ level: 'intermediate platform: none type: [tutorial tool] domain: 'x-file tested-under: none support: none license: none see-also: none ] ] 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 ] ] ]
halt ;; to terminate script if DO'ne from webpage
Notes
  • email address(es) have been munged to protect them from spam harvesters. If you are a Library member, you can log on and view this script without the munging.
  • (dockimbel:free:fr)