I've done this sort of thing before here:
Output Console Buffer Problems
For your use case, the code boils down to this:
from com.inductiveautomation.ignition.client.util.gui import OutputConsole
# Get an instance of the console
# Find the scroll pane,
# ...and return the text property from the internal JTextField
def getConsoleText():
console = OutputConsole.getInstance()
for component in console.components:
if hasattr(component, 'viewport'):
return component.viewport.view.text
# Get the console text, and do something with it
consoleText = getConsoleText()