How could I leave the Script Dialog open when I click OK?

I want to use script dialog to create many different files with different contents, so I don't want it autoclose after run once.

You need to be using a detached dialog for that, not a simple one. (See here for the difference between the two.)

You can then have a button with the Close Dialog property set to False, and your script can react when it is pressed. (Detached Dialogs has some more detail.)

I don't know how to obtain the button click event, could you give me a little sample :grinning: