A: | There is a plugin available called MacroManager that
will provide a similar interface to jEdit's plugin manager
for installing new macros. The plugin downloads the macros
from the jEdit Community site, so an internet connection is
necessary. </p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1342"></a><a name="macro-new-store"></a><p><b>Q:</b></p></td><td align="left" valign="top"><p>I just wrote a new macro for myself. Where should I
save the file?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><b>A:</b></p></td><td align="left" valign="top"><p>There is a <code class="filename">macros</code> directory in
your user settings directory. If you store your macro there
it will appear in jEdit's menu
under the name you have given to the macro's source code
file. The <code class="filename">.bsh</code> will be deleted in the
macro entry, and underscore characters will be converted to
whitespace, so that the file
<code class="filename">My_New_Macro.bsh</code> will be displayed as
<span class="guimenuitem"><strong>My New Macro</strong></span>.</p><p>You can create additional subdirectories in the
<code class="filename">macros</code>to organize your personal macros
by category. Each subdirectory will correspond to a submenu
under the application's menu. This
is helpful to reduce the screen space used to display the
macros menu at any one time.</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1372"></a><a name="macro-new-ext"></a><p><b>Q:</b></p></td><td align="left" valign="top"><p>Do I have to use the <code class="filename">.bsh</code> file
extension when I save one of my own macro scripts?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><b>A:</b></p></td><td align="left" valign="top"><p>You need the <code class="filename">.bsh</code> extension in
order for jEdit to detect and display the name of the macro
in its <span class="guimenu"><strong>Macros</strong></span> menu. The macro must also
be in the <code class="filename">macros</code> directory of either
the jEdit installation directory or the user settings
directory.</p><p>You do not need the extension to run a macro, however.
By selecting <span class="guimenu"><strong>Macros</strong></span>><span class="guimenuitem"><strong>Run
Other Macro...</strong></span>, you can choose any file to be
run as a macro. While in a macro, you can call
<strong class="userinput"><code>source("full_path")</code></strong> to do the same
thing.</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1402"></a><a name="macro-temp"></a><p><b>Q:</b></p></td><td align="left" valign="top"><p>How can I store the result of a macro so that the next
time I run it the macro can retrieve the value?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><b>A:</b></p></td><td align="left" valign="top"><p>You can use either
<strong class="userinput"><code>jEdit.setProperty(String, String)</code></strong> or
<strong class="userinput"><code>jEdit.setTemporaryProperty(String,
String)</code></strong>. Both methods take
<code class="classname">String</code> values for the name of the
property and its value. If you use
<strong class="userinput"><code>setProperty()</code></strong>, the property will
remain in jEdit's property store permanently, so if you only
need the value during the course of a single editing
session, use
<strong class="userinput"><code>setTemporaryProperty()</code></strong>.</p><p>To ensure that your value can be stored regardless of
its type, use the following syntax:</p><pre class="programlisting">jEdit.setTemporaryProperty("myValueName", myValue.toString());</pre><p>
and remember to convert the <span class="quote">“<span class="quote">myValueName</span>”</span>
property back to its intended type when you retrieve
it.</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1432"></a><a name="macro-exec"></a><p><b>Q:</b></p></td><td align="left" valign="top"><p>In a macro I'd like to exec an external program (e.g.
jmk, javac) and capture its output to a buffer. I'd also
like to see this output as the external program runs or be
able to interact with the program. So when I exec, what
happens to System.in/out/err of the exec'd program? |
A: | Use the runInSystemShell() or the
<code class="filename">runCommandToBuffer()</code> script methods
that come bundled with the Console plugin. The help
documentation for Console provides details on these methods.
Currently the Console's System shell is not interactive
during execution of a command, but it does receive and
display the standard output and error streams of the
external process.</p></td></tr></tbody></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="plugins.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Usage Questions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Plugin Questions</td></tr></table></div></body></html>
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|