Abort dynamic evaluation error when I open a txt by Mathematica

I have not tried your code, but you might want to try adding the option

Method->”Queued”

to the button.

thank you, David , it works now.

by the way, the reason why this is necessary is that when button code opens up something, such as a dialogue, that takes longer than the default, dynamic timeout for preemptive actions (which is six seconds by default unless you change that in your mathematic settings) the operation will time out, and you will get a warning. For queued evaluations this does not apply. And it is generally true for something like a dialogue you always wanted to be queued so that it interrupts whatever else is going on in the system until you put the input that the dialogue is requesting