I want to run a script instead of pressing a button and get the same results as the actionPerformed event on the button. Basically, virtually pressing a button using a script.
Put the logic into a project script. Then you can call it from anywhere (within the project).
What’s the trigger, and why do you think you need to press a button to activate the script ?
But the logic uses properties from other components on a template so I would have to pass a bunch of parameters to the project script and back
The trigger is a simple 'if' condition in a script on the same template as the button. So when this if condition is met I want to execute the "action performed" script of the button. It's a really long script that's why I didn't want to copy paste it and just "click" the button instead.
That’s still the appropriate way of doing this.
Also, I’m sure you could reduce the number of parameters to pass by pre-processing things and storing the results in properties
Though I just saw you’re on 7.9, and there might be different ways of doing things in vision
Gotcha, thanks! I remember doing this before, where I was able to virtually press the button but I can't seem to find it on my current project.
Thanks for helping though
I would recommend learning from this experience. I write all my business logic in project scripts as much as possible first and recommend that to my newer ignition coworkers, and then call them from the GUI or tag change events or what have you. The GUI should only be there to let users pick parameters for these functions. Then this sort of situation would be very easy to manage.
@JordanCClark That's exactly what I was looking for doClick().
Thanks a lot for the quick response!!