how to execute a script?

dear list
i found the answer to the question how to shut down a pc via touch in this topic.
[How to control shutdown.exe? [Solved])
the attached scene contains a textDAT with the script from the thread above.
the script runs great if the textDAT is executed by right-click/ run script
the pc shuts down, as it should.
but if the script is in a chopExecute, nothing happens when value changes.
please see the attached scene.
is there a difference between right-click/run script and execute it in an chopExecute?
and if, how do i it right?
thank you for your help
best luca
shutdown.4.toe (4.71 KB)

There should be no difference here. Have you tried just using it in a offToOn() method instead of valueChange so it only runs once, not on both button down and button up?

When I add a print() statement I can see the script is running (I commented out the shutdown, I don’t want to shutdown :confused: ).

dear ben
thank you very much for your answer!
sadly no one works, no offToOn nor any other way to execute the script via chopToDat… :-/
still only way is to start it with right mouse run script…
but i found a way to shut down the box less elegant, but could be worse… :slight_smile:
…still would take me wonder why it doesnt work, so if you have to shut down your pc you might trying it out!

anyway thank you

Here’s an example of what Ben was saying.
NewProject.toe (4.57 KB)

and if you are stuck on a node, the examples in Help → OP Snippets may give some ideas.

thank you
all and lots more than in your provided example was tried out, doesnt work at all.
but its ok, im used to find workarounds.

which part of the example doesn’t work?

Luca, did you solve this problem?
I’m having the same problem.

yep, see attached tox

run_script.tox (1.1 KB)

The more modern way to do that is to use a Button COMP from the 2022.Official builds and use a Parameter Execute DAT looking at the Value parameter of the button. No need for Null CHOP.