Home   Archive   Permalink



Trigger close event for Rebol Console

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".

posted by:   Sergey_Vl     21-Nov-2023/4:16:50-8:00



You know how to do that on inputvof another selfdefined user command. So redefine q and quit functions to first perform such a function.

posted by:   Arnold     21-Nov-2023/13:31:33-8:00



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?

posted by:   Sergey_Vl     21-Nov-2023/16:58:48-8:00



The function does not work when closing the window using Alt+F4 :(

posted by:   Sergey_Vl     21-Nov-2023/17:00:50-8:00



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.

posted by:   Arnold     26-Nov-2023/4:02:38-8:00



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


posted by:   Sergey_Vl     27-Nov-2023/17:14:42-8:00



Name:


Message:


Type the reverse of this captcha text: "e n i l"



Home