The simplest use of macros is to record a series of key strokes and menu commands as a BeanShell script, and play them back later. While this doesn't let you take advantage of the full power of BeanShell, it is still a great time saver and can even be used to “prototype” more complicated macros.
C+m C+r
) prompts for a
macro name and begins recording.
While recording is in progress, the string “Macro recording” is displayed in the status bar. jEdit records the following:
Key strokes
Menu item commands
Tool bar clicks
All search and replace operations, except incremental search
Mouse clicks in the text area are not recorded; use text selection commands or arrow keys instead.
C+m C+s
) stops
recording. It also switches to the buffer containing the recorded macro,
giving you a chance to check over the recorded commands and make any
necessary changes. When you are happy with the macro, save the buffer
and it will appear in the menu. To discard the
macro, close the buffer without saving it.
The file name extension .bsh
is automatically
appended to the macro name, and all spaces are converted to underscore
characters, in order to make the macro name a valid file name. These two
operations are reversed when macros are displayed in the
menu; see the section called “How jEdit Organizes Macros”
for details.
If a complicated operation only needs to be repeated a few times, using the temporary macro feature is quicker than saving a new macro file.
C+m C+m
) begins
recording to a buffer named Temporary_Macro.bsh
.
Once recording of a temporary macro is complete, jEdit does not display
the buffer containing the recorded commands, but the name
Temporary_Macro.bsh
will be visible on any list of
open buffers. By switching to that buffer, you can view the commands,
edit them, and save them if you wish to a permanent macro file. Whether
or not you look at or save the temporary macro contents, it is
immediately available for playback.
C+m C+p
) plays the macro
recorded to the Temporary_Macro.bsh
buffer.
Only one temporary macro is available at a time. If you begin
recording a second temporary macro, the first is erased and cannot be
recovered unless you have saved the contents to a file with a name other
than Temporary_Macro.bsh
. If you do not save the
temporary macro, you must keep the buffer containing the macro script
open during your jEdit session. To have the macro available for your
next jEdit session, save the buffer
Temporary_Macro.bsh
as an ordinary macro with a
descriptive name of your choice. The new name will then be displayed in
the menu.