Handy tips for running scripts:
- Ctrl+Enter and Ctrl+R are both shortcut keys for "Run Script".
- If you highight just part of the text in the input area, then Groovy runs just that text.
- The result of a script is the the value of the last expression executed.
- You can turn the System.out capture on and off by selecting "Capture System.out" from the "Actions" menu
You can open any text file, edit it, run it (as a Groovy Script) and then save it again when you are finished.
- Select File -> Open (shortcut key ctrl+O) to open a file
- Select File -> Save (shortcut key ctrl+S) to save a file
- Select File -> New File (shortcut key ctrl+Q) to start again with a blank
History and results
- You can pop-up a gui inspector on the last (non-null) result by selecting "Inspect Last" from the "Actions" menu. The inspector is a convenient way to view lists and maps.
- The console remembers the last ten script runs. You can scroll back and forth through the history by selecting "Next" and "Previous" from the "Edit" menu. Ctrl-N and ctrl-P are convenient shortcut keys.
- The last (non-null) result is bound to a variable named '_' (an underscore).
- The last result (null and non-null) for every run in the history is bound into a list variable named '
__' (two underscores). The result of the last run is
_[-1], the result of the second to last run is
[-2]and so forth.