Skip to content

04. Creating a Custom Recorder

ThisTestUser edited this page Jun 6, 2022 · 4 revisions

The default recorder already captures all mouse and keyboard inputs. However, in certain cases, a custom recorder may be needed. Custom recorders extend com.thistestuser.cursormacro.recorder.Recorder, and are added in the com.thistestuser.cursormacro.recorder.custom.CustomRecorders.register() method. That method adds a singleton instance of the custom recorder which should be initialized in the method. It is recommended that the CursorMacro instance be passed in via the constructor as a field.

Here are the methods that need to be implemented:

setup()

This method only runs once at startup. The objective is to initialize fields and setup listeners. The recorder should not be capturing data when this method is called.

isRecording()

This method checks if the recorder is active.

startRecording(mouseDelay, snap)

This method asks the recorder to start capturing data. The mouseDelay and snap arguments are from the "Mouse Interval" and "Snap Mouse" inputs and can be ignored if irrelevant. If the CursorMacro instance is accessible, then the CursorMacro.stateLbl.setText() method can be called to debug the state of the recorder.

stopRecording(pane)

This method asks the recorder to stop capturing data. The pane argument is the JTextPane. It is safe to overwrite any data in the pane. The script that is placed in the pane is not compiled automatically.

getStringRepr()

This method returns a string that will be shown in the drop down panel.

Clone this wiki locally