Under normal circumstances, giving a command to

press the Button

is stupid. Because we only need to execute the button action of that Button.

But under some circumstances, a button action alone doesn't work, it makes an warning message.
With a little surprise, if we put the button action alone into a mathematica Button, and click that Button, it works.

So I am trying to find way to command to press a Button.

Can you make a command, when executed, it presses following button :

Button["Click Here", Print[10!]]

I believe that

the more independent act of pressing a button is from action of the button,

the higher the chance of success.

In Huber's case, it failed because it approached the button's action too directly.

Here is the motivation of this question :

Save as custom folder succeeded! But in two steps

  • $\begingroup$ What warning message? Don't you want to fix the cause of the problem|? $\endgroup$
    – Kuba
    Commented Feb 6 at 7:49
  • $\begingroup$ @Kuba ♦: Yes, I updated the question. You can check it in mathematica.stackexchange.com/questions/297619/… $\endgroup$
    – imida k
    Commented Feb 6 at 18:00

1 Answer 1



but = Button["Click Here", Print[10!]];
but // FullForm

enter image description here

As yiou can see, the button action is the second element in "but". Therefore, to evaluate it, you can simply write:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.