For your second question read this post from @Fox ,
maybe its what you need. Its in Russian, but you can
use translator. There is an example script too >
how to send data to text file?
-
@danielz Hi, thanks.
Also these articles may be usefullhttps://wiki.bablosoft.com/doku.php?id=how_to_output_script_result
https://wiki.bablosoft.com/doku.php?id=how_to_let_user_to_choose_output_file_name