Skip to content

Instantly share code, notes, and snippets.

@petebankhead
Created December 31, 2016 13:02
Show Gist options
  • Save petebankhead/6f73a01a67935dae2f7fa75fabe0d6ee to your computer and use it in GitHub Desktop.
Save petebankhead/6f73a01a67935dae2f7fa75fabe0d6ee to your computer and use it in GitHub Desktop.
Short script to show use of 'guiscript=true' within a script run through QuPath v0.1.2
// guiscript=true
def qupath = getQuPath()
def menuItem = qupath.getMenuItem("Automate>Show workflow command history")
menuItem.fire()
/* If guiscript=true is missing from the first line,
* then menuItem.fire() will fail because it is called on the wrong thread.
*
* In this case, the required syntax would be:
*
* javafx.application.Platform.runLater({ -> menuItem.fire()})
*
*
* Note: guiscript is not intended for routine use, since it blocks
* the main thread required by the entire QuPath user interface,
* and therefore can make QuPath unusable, or prevent useful feedback
* such as progress bar updates.
*
* It exists as an option to help run very short, GUI-related scripts more easily.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment