[REBOL] Re: Make_user_manual.r ?
From: brett:codeconscious at: 26-Jan-2002 0:01
Hi Sunanda,
I played around with the view player to handle scripts where a plain "view"
call is used. I'm still not sure
how robust this is but for now it seems like it could be useful.
Attached is a script to simulate a calculator session with a new version of
play-app
Brett.
-- Attached file included as plaintext by Listar --
-- File: view-player.r
Rebol [
Title: "View Player"
Date: 24-Jan-2002
Purpose: "An experiment in dynamically altering a View application."
Author: "Brett Handley"
Comment: {
Assumes only one wait in the target application.
}
]
play-app: function [
app [file! block!]
script [block!]
][was-error][
process-events: :wait
wait: does script
if was-error: error? err: try [do app][disarm err]
wait: :process-events
if was-error [print mold :err halt]
]
-- Attached file included as plaintext by Listar --
-- File: play-calculator.r
Rebol []
; Use-script is my local script manager.
; Define it if we are in another environment.
if not value? 'use-script [
either value? 'load-thru [
use-script: func[script][do load-thru join http://www.codeconscious.com/rebol-library/
script]
][use-script: :do]
]
use-script %face-searches.r
do %view-player.r
app: load-thru http://www.rebol.com/view/demos/calculator.r
play-app app [
; Set up the calculation
foreach [btn] ["6" "*" "9" "+" "4" "6"] [
do-face fce: find-key-face system/view/screen-face to-char btn none
]
save/png %calc1.png to-image first system/view/screen-face/pane
; Calculate the result
do-face fce: find-face system/view/screen-face ["=" = face/text] none
save/png %calc2.png to-image first system/view/screen-face/pane
]