Trigger close event for Rebol Console

Started by Sergey_Vl on 21-Nov-2023/4:16:50-8:00
How to trigger close event for Rebol Console to execute some custom handler before one quit the console? I want to save system/console/history and output in the console after the user gives the command "q" or "quit".
You know how to do that on inputvof another selfdefined user command. So redefine q and quit functions to first perform such a function.
Thank you. I somehow didn’t think about the function and did: >> pr: 'print == print >> pr 3 + 5 == 8 >> qq: 'q == q >> qq == q >> qq: 'quit == quit >> qq == quit >> probe qq quit == quit >> The function worked great >> q: func [] [wait 3 quit] Is it possible to save everything in the console? "echo %file" stores only the interpreter output, without user input, and "system/console/history" contains only the input. Is it possible to save the full console state?
The function does not work when closing the window using Alt+F4 :(
Probably it won't either if you kill the app using taskmanager? Can't win them all unfortunately. Somehow find out how to get in the middle of that Alt+F4 if it is a must have.
I thought maybe something like: insert-event-func[e: :event if e/type = 'close [flash "Aaa!" wait 3 quit]] view layout[text "Abc"] ...only for the console window

Reply