Macros are simply recordings of actions in an RSyntaxTextArea that can be played back. You can set up an application so that the user can choose to "record" a set of actions in the editor, then play them back later. The relevant methods on the RSyntaxTextArea class (inherited from RTextArea, but see Javadoc for all RSTA classes here
- public static void beginRecordingMacro()
- public static void endRecordingMacro()
- public static void loadMacro(Macro)
- public static Macro getCurrentMacro()
The Macro class
encapsulates the set of actions. It can be loaded and saved to disk via its constructors and its saveToFile() method. Macros are saved as simple XML representations of the actions to execute.
The idea is that an application that supported macros would have say a menu item, "Begin Recording Macro". On clicking it, all editor actions (typing, selecting text, etc.) are recorded to a Macro instance (via textArea.beginRecordingMacro()). A second menu item, "End Recording Macro", is clicked, resulting in textArea.endRecordingMacro() being called. The user can then be prompted for macro name, and the macro saved to a file. The application could display a list of previously recorded macros, say in a menu, for the user to play back.RText
the same functionality, so perhaps I'll add it back some day...