Very Useful Function : Reload the new code
[1/4] from: brett::codeconscious::com at: 14-Mar-2002 23:38
You could add it to you local folder and make an icon for it by editing the
index file.
If I understand you, it should be enough I think
Right click the "Local" folder icon on your Rebol View desktop.
Click "Edit"
Insert a line like the following:
file "test" %test.r info "My test program."
Click "Save", and then "Quit"
Copy your test file into the "local" directory under your "View" directory.
Then just click your new icon to test your program!
Brett.
[2/4] from: sunandadh:aol at: 14-Mar-2002 11:04
Phillippe:
> Is there somebody who already developed a function placed on a button for
> VID that could :
> 1) completely free the memory with the old code
> 2) and re-load the new .r and re-open a new window
I don't know if this helps, but you could gut the code below to get the sort
of effect you want.
This code is my wrapper for an application.
The payload -- the main application is the line Do %esinMain.r.
The rest of the code simply wraps this in a Try block. If an error occurs the
error recovery does one of two things:
-- If the error is a specific user error it automatically restarts. The
application triggers this error to force the sort of restart you want --
somewhere in the depths of the application this line triggers a restart:
make error! "restart-request"
--Any other error is logged and reported, and the user offered the chance to
restart or quit.
(Watch out for strings wrapping across lines in the cut'n'pasted code)
Sunanda.
---------------------------
rebol [title: "esinGo.r"]
ESIN-VERSION: "00.00.03"
;; Sign-in /user identification / data integrity checks
;; ----------------------------------------------------
do %esinSign.r
;; Repeated execute application until exit
;; ---------------------------------------
while [true] [
ESIN-ERROR: copy []
error? try [unset 'ESIN-ERROR]
error? try [unset 'GLOBAL-ERROR-MESSAGE]
;; Run the application
;; -------------------
If error? ESIN-ERROR: try [
unview/all
do %esinMain.r ;; payload!!
][
;; report / recover from error
;; ---------------------------
ESIN-ERROR-1: disarm ESIN-ERROR
either all [esin-error-1/code = 800
esin-error-1/type = 'user
esin-error-1/arg1 = "Restart-request"
][
;; either/true: application wants auto restart
;; -------------------------------------------
error? try [Esinutil/Write-Log ">>>ESIN/CM Restart on
application request"]
][
;; either/false: application error
;; -------------------------------
unset 'ESIN-ERROR
error? try [Esinutil/Write-Log "<<<<<<<ESIN/CM HAS
CRASHED>>>>>>>>"]
error? try [Esinutil/Write-Log
either value? 'GLOBAL-ERROR-MESSAGE
[GLOBAL-ERROR-MESSAGE]
[mold ESIN-ERROR-1]
] ;;try
unview/all
Error-string1: copy ""
Error-string2: copy ""
error? try [error-string1: to-local-file DATA-DIRECTORY]
if Error-string1 <> "" [
error-string2: join "Along with all the files in "
data-directory
]
;; Report back to user, and offer restart or quit
;; ----------------------------------------------
view layout [
info 500x250 black font-color white font-size 15 wrap
join "Oh Dear!^/^/ESIN/CM "
[ESIN-VERSION
" has fallen over!^/ ^/"
"If you can be bothered, please make a note
of "
"the cryptic stuff below and send it to
Sunanda at "
"[xxx--xxxx--xxx]"
newline
newline
Error-string2
newline
newline "Thanks!"
]
info 500x400 black font-color white font-size 12 wrap
either value? 'GLOBAL-ERROR-MESSAGE
[GLOBAL-ERROR-MESSAGE]
[mold ESIN-ERROR-1]
info 500x100 black font-color white font-size 15 wrap
join "In most cases, you can clear the error and "
["keep working simply by clicking the "
"Restart button below.^/"
]
across
button "Restart"
[error? try [EsinUtil/WriteLogEntry "Restart
taken..."]
unview/all
]
tab
button "Exit" [Quit]
] ;; layout
] ;;either/false
] ;;if-error
] ;;while
quit
[3/4] from: info:id-net:ch at: 14-Mar-2002 13:05
Hi all !
I'm analyzing the time I take to develop and I see that a large part to
develop is going back to the shell, re-execute my .r file to open a new
VID window to see the changes I made in the code. And afterall, close the
300 windows opened each day 8-))
So I'm thinking it will be easier to place a button in my window that could
reload...
Is there somebody who already developed a function placed on a button for
VID that could :
1) completely free the memory with the old code
2) and re-load the new .r and re-open a new window
..or someone who got ideas how to do it ...
Philippe Oehler
[4/4] from: info:id-net:ch at: 14-Mar-2002 18:23
Superb ! Thanks Sunanda. It's very useful. I put a button in my
application, to restart the application when needed. It's precious seconds
saved ...
Philippe