I am trying to click a button from the Tag Events, Value Changed script section. For some reason I cannon get by button to click. The first action (swapTo) is being performed properly, but not the second. I am also not getting any errors. What am I missing?
That event happens in the gateway, not in a client. You’ll have to use a project Tag Change Script. Look in the “Project”, “Scripts”, “Client Event Scripts” dialog.
Duh. doClick() is built in. However, I don’t see anything that ensures that tag events happen on the foreground thread. Try using invokeLater() to run the doClick() method.
It puts the given callable (function or method) on the foreground thread’s event queue for immediate execution. In Swing, that thread is called the “Event Dispatch Thread”, and is the only thread allowed to interact with GUI components.
I’m still not getting any action out of this script in the Tag Change section. What is the difference between running script here as apposed to running it on the Tag Even, Value Changed section?
For a Client tag, nothing.
Next possibility:
Which event on your button contains your printing code? I believe doClick() will only work with the actionPerformed event, as there's no actual mouse events generated.
Yep that’s where the script is on the button. It’s a print button that sends reports to a specific printer, then clears a bunch of client tags. The button functions correctly as well, I just want to automate it’s functions.
I’m a little surprised that you don’t get an error when using event.source.parent...
In a tag change script, the event source is a tag, not a window. You’ll have to get a reference to your window first.