is it possible to "lock" the buttons while a script is working?
I know that you can open a custom window that block the window below, but there is the possibility to lock the buttons without open a custom window?
Which buttons are you finding that you are allowed to click while a script is running? The cancel script button? That button can be eliminated by setting Allow User Abort to [off]. Or is this a situation where the script is paused for input and you want to prohibit access to certain buttons?
If you mean custom buttons that are a part of the layout, then one quick and easy way would probably be making them invisible while the script is running. All you really need is a utility table with some global fields that represent the buttons visibility.
Set the "Hide object when" property to correspond to the global fields and toggle them when the scripts starts and ends. I've used this in a few tools I made with FM, and it works fairly well. If you want a visual effect to go with it, rather than the button just going away, lay the actual button over a dummy picture that looks like the button is "off".
Retrieving data ...