Clear output console contents from script

Is it possible to clear the content of the output console from a script? Or to simulate clicking the Clear button to do the same? Both in the designer and the client?

from com.inductiveautomation.ignition.client.util.gui import OutputConsole
OutputConsole.getInstance().getComponent(0).getComponent(1).doClick()

Works in the designer, not the client. In the client, you’d have to find the separate window that holds the ‘Diagnostics’, then step into it, find the button, and click it.

1 Like

Is this still possible?

OutputConsole.getInstance().getComponent(0).getComponent(1).doClick()

Tells me:

NameError: name 'OutputConsole' is not defined

Anything I would need to import?

The formatting got messed up in some forum migration; how about with the import on the first line?

Also, a better/less fragile way to do the same thing:

from com.inductiveautomation.ignition.client.util.gui import OutputConsole
from java.awt.event import ActionEvent

console = OutputConsole.getInstance()
console.actionPerformed(ActionEvent(console, 0, "clear"))

Actually neither of them seemed to do it, maybe a good clarification is that I an running this within the script console itself, would that affect things?

Oh, the script console is totally different. This is clearing the ‘Output Console’ you get in the designer. I don’t see any good way to trigger a programmatic clear of the script console. Though, fun fact, Ctrl + L does work there.

Ahh, read that wrong darn

Was looking for a way to clear it between the running of each script so I could just keep hitting the execute button and monitoring changes, Ctrl+L will have to do! Thanks