* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<head>
-<title>Groovy Shell</title>
+<title>Groovy Console</title>
</head>
<body>
<p>
- <strong>The Groovy Shell</strong>
+ <strong>The Groovy Console</strong>
</p>
<p>
Groovy (<a href="http://www.groovy-lang.org/">www.groovy-lang.org</a>)
short pause, you should then see the <a
href="https://groovy-lang.org/groovyconsole.html">Groovy
Console</a> appear. This allows you to interactively execute Groovy
- scripts whilst Jalview is running. We've also provided a <strong>Calculations→Execute
- Groovy Script</strong> button so you can execute the currently loaded
+ scripts whilst Jalview is running. We've also provided a <strong>Calculations→Run
+ Groovy Console Script</strong> button so you can execute the currently loaded
groovy script whilst viewing an alignment.
</p>
<p>
we recommend you also take a look at Jalview's source, since all the
public methods of the jalview class hierarchy can be called from
Groovy scripts. In addition, the following objects are also defined:
+ </p>
-
-
<ul>
- <li><strong>Jalview</strong> - this is bound to <code>jalview.bin.Jalview</code>.<br />Useful
- methods include:
+ <li><strong>Jalview</strong> - this is bound to <code>jalview.bin.groovy.JalviewObject</code> providing access to the following useful
+ methods:
<ul>
<li>Jalview.getAlignFrames() - returns a list of
jalview.gui.AlignFrame objects</li>
<li>Jalview.getCurrentAlignFrame() - returns the alignment
- window which is currently being looked at by the user</li>
+ window which has most recently been in focus. If you change focus to another alignment window then re-running <code>Jalview.getCurrentAlignFrame()</code> will return the new <code>AlignFrame</code>.</li>
</ul></li>
- <li><strong>currentAlFrame</strong> - this is only defined when
- running a Groovy script via the --groovy command line argument. It
- returns the first alignment window created after acting on the
- other arguments passed on the command line.</li>
+ <li><strong>currentAlFrame</strong> When used on the command line this refers to the current opened alignment.
+ <br/>
+ When used from the Groovy Console, it refers to the alignment that was in focus when the Groovy Console was opened.
+ <br/>
+ When a Groovy Console script is run from <em>Calculate</em>-><em>Run Groovy Console Script</em>, <code>currentAlFrame</code> us updated to that alignment.</li>
</ul>
<p>
+ If you specify a <code>--groovy</code> argument before an <code>--open</code> argument
+ then you should ensure your script doesn't refer to <code>currentAlFrame</code>.
+ <p>
+
+ <p>
<em>A simple script</em><br />
<ul>
<li>Getting the title, alignment and first sequence from the
current alignFrame<br> <pre>
-def alf = Jalview.getAlignFrames();
-print alf[0].getTitle();
-def alignment = alf[0].viewport.alignment;
+def al = Jalview.getCurrentAlignFrame();
+print al.getTitle();
+def alignment = al.viewport.alignment;
def seq = alignment.getSequenceAt(0);
</pre>
</li>
status.cancelled_image_export_operation = Cancelled {0} export operation
info.error_creating_file = Error creating {0} file
exception.outofmemory_loading_mmcif_file = Out of memory loading mmCIF File
-label.run_groovy = Run Groovy console script
-label.run_groovy_tip = Run the script in the Groovy console over this alignment
+label.run_groovy = Run Groovy Console Script
+label.run_groovy_tip = Run the script in the Groovy Console over this alignment
label.couldnt_run_groovy_script = Failed to run Groovy script
label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
action.next_page= >>