How to record a macro in a text editor on Mac
You can do this with Note My. A macro records the edit you made and the movements you used to make it — here is how to record one, what it captures, and how to replay it across as much work as you like.
You have four hundred lines that all need the same small change. Wrap each one in quotes, add a trailing comma, delete the third field, rename a symbol that a plain search-and-replace cannot safely reach. Doing it once is fine. Doing it four hundred times is the kind of work that produces mistakes at line three hundred and eleven.
A macro is the answer to that: you perform the edit once while the editor watches, and it replays what you did. This guide covers recording in Note My — how to start, what our macro recorder captures, how to replay it over a file or every open tab, and how to keep a whole run reversible while you build the habit.
What a macro is here
A macro is the edit you performed, played back in the order you performed it. That is its strength: what you see yourself do is exactly what comes back, so a macro you record on a Tuesday behaves the same way on a Friday. It follows the commands you used rather than the pixels you clicked, so a macro keeps working when you resize the window, move to another tab, or scroll somewhere else entirely.
Two kinds of thing go into a recording.
- Movements and selections — move left, move to the end of the line, extend the selection up a line, select all.
- Changes to the text — typing, deleting, pasting, replacing a selection, indenting and outdenting, Return and Tab.
Our macro recorder gives you back the edit you made rather than a transcript of every key you pressed: type a word along a line and it comes back whole, in one step. What it does follow closely is the way you moved, so use the command that means what you intend — press the shortcut for the end of the line and the macro goes to the end of every line it meets, however long they are.
Reach for a macro when the change is too shapely for a straight substitution — moving along a line, selecting part of it, typing in more than one place. If one pass of our find and replace would do it, use that instead.
Recording keeps its attention on your document. Every step it holds is an edit or a movement in your text, which is what makes a run repeatable, reviewable and reversible. It all happens on your Mac: nothing is uploaded, there is no account, and your files never leave the machine.
Record a macro
-
Put the caret where the edit begins
Recording starts from wherever you are. Get the document into the state you want the macro to assume — the right tab, the right line, the caret at the start of it — before you start recording, not after. Anything you do to get there afterwards becomes part of the macro.
-
Start recording
Press ⌥⌘R, or choose Macro ▸ Start Recording. The toolbar Macros pull-down carries the same toggle, and its tooltip reads "Open the Macros menu."
Two things confirm you are recording. A glass pill appears near the top of the window with a pulsing red dot, the words Recording Macro, and a running count of actions captured so far. At the same time the toolbar's Macros glyph flips to a red stop symbol.
-
Perform the edit once, carefully
Do the whole edit exactly as you want it repeated. Watch the action count in the pill as you work: it ticks up while your edit is picked up, so you can see the macro filling out step by step and know it is ready before you stop.
Prefer keyboard navigation over clicking. The movement commands you use are what the macro carries, so a recording built from arrows, word jumps and line-end shortcuts lands in the same relative place on every repeat, wherever in the document you set it going.
If you intend to run the macro down a whole file, end the recording where the next repeat should begin: a move down a line, then a move to the beginning of it. A macro that ends where it starts can be run fifty times in one go.
-
Stop recording
Press ⌥⇧⌘R, or choose Macro ▸ Stop Recording. The pill is replaced by a short confirmation reading "Recorded N actions."
-
Save it, or don't
A moment later a sheet asks Save this macro? with Save, Don't Save and Cancel. Save asks for a name and keeps the macro on your Mac for next time. Declining does not throw the recording away — it stays as the current macro and can still be played; it just will not be there after you quit.
What gets captured
| Kind | Captured |
|---|---|
| Movement | Left, right, up, down · word left, word right · beginning and end of line · beginning and end of document |
| Selection | All ten of the same movements with the selection extended, plus Select All |
| Clipboard | Cut, Copy, Paste |
| Text change | Typing, deletion, paste, replacing a selection, indent and outdent, Return, Tab |
| Search | Find Next, Find Previous, Replace |
| Navigation | Go to Line |
| Bookmarks | Toggle bookmark, next bookmark, previous bookmark |
| Document | Save, convert encoding, convert line endings, rename a tab inline |
A single recording holds as many actions as your edit takes, so record the whole change in one pass rather than splitting it into pieces you have to remember to run in order.
How to read the action count
The count in the pill follows your edit, not your keystrokes. Type hello along a line and the count moves by one, not five. Nothing is lost: the whole word is typed back on playback. So read the count as confirmation that your work is being picked up, not as a tally of keys — what matters is that it keeps moving as you go, and that it stops moving when you stop editing. The step list in the Manage Macros window reads the same way, which keeps it short enough to scan weeks later.
Deleting, Return and Tab are recorded
Deleting text, pressing Return and pressing Tab are all captured, and they replay exactly as you performed them. Use them freely inside a recording: a line broken in two, a block pushed in a level, a stray character taken out — each one comes back the same way on every repeat.
Recording tells you as it goes
You are kept informed while you record. The action count is the steady signal, and where a command belongs outside a recording you hear about it at record time: a short beep, and a message reading "That action can't be recorded."
That immediacy is the whole point. Told in the moment, you pause, take a different route to the same result, and carry on with a recording you can rely on — rather than replaying a twelve-step edit across forty tabs and working out afterwards what happened at step seven. One beep at the time, and the cleanup never has to happen at all.
If the beep is not welcome — in an open office, or when you are working through a long sequence and would rather read than hear — it can be switched off in Settings ▸ Macros. The message is what carries the information; the sound is only an alert.
Playing it back
Press ⌥⌘P or choose Macro ▸ Playback. Both play commands open the same sheet, titled Replay Macro, which asks two questions.
- Scope — Current Tab or All Open Tabs. A run across all tabs covers the tabs that were open when you started it, and leaves out any tab you close while it is running.
- Repeats — a stepper from 1 to 9,999. Macro ▸ Playback arrives pre-armed at one iteration and Playback Multiple Times… at five. Anything above 50 asks you to confirm first, unless you have turned that confirmation off.
Playback runs your macro straight through, with an optional pause between actions of 0 to 200 ms, default 0. Raise it when you want to watch a run happen and see which step goes wrong. ⎋ cancels a run in progress.
The single most important guarantee: one ⌘Z reverses a whole run, however many repeats it made and however many tabs it touched. The Edit menu names it Undo Macro Playback. That is what makes it safe to try a new macro once, on real work, before you set it to run fifty times.
When it finishes, a report sheet shows three chips — Succeeded, Skipped and Failed — with a list of every row that was not a success, its tab, and an English reason. By default a failing action is skipped and the run continues; a run that did nothing at all skips the sheet and shows a brief message instead.
Managing what you have recorded
Alongside recording and playback there is Save Current Macro…, which prompts for a name, and Delete Current Macro, which clears only the recording you have just made and leaves your saved macros alone. Manage Macros… opens a window listing your saved macros with a numbered list of each one's steps, and buttons to rename, delete, run, or run a set number of times.
Name macros for what they do to a line — quote and comma, strip third field — rather than for the file you first used them on. Weeks later that is what tells you which to run.
Settings ▸ Macros holds the macro preferences: show the recording indicator (on), beep on an unrecordable action (on), stop playback on the first error (off), the playback delay in milliseconds (0, adjustable between 0 and 200), and the confirmation before a long run (on).
Troubleshooting
I am not sure whether I am still recording
Look for the pill. On screen with its pulsing red dot and a live count, you are recording; gone, and you are not. The toolbar's Macros pull-down tracks the same state, its glyph showing a red stop symbol for as long as a recording is running. Between the two you can tell at a glance from anywhere in the window, without breaking off the edit to check.
No indicator appears when I start recording
The pill is a preference. Switch it on in Settings ▸ Macros and it returns to the top of the window for every recording, count and all. Keeping the toolbar visible gives you the second cue alongside it. Most people leave both on and stop thinking about it.
The action count did not move when I expected it to
The count follows your edit rather than your keystrokes, so a run of typing along one line moves it once. A count that sits quietly almost always means your last action was folded in with the one before it, and the whole thing is typed back in full on playback. Where a step wants a different route you are told at the time, so quiet is a good sign.
Playback edited the wrong place
A macro repeats your edit from wherever you set it going, so where you leave the caret before you play is where the work lands. If you recorded from line 1 and play back from line 40, or against a document whose lines are laid out differently, the edits land somewhere you did not intend. Put the caret back where the recording began before you play, and build the recording itself from keyboard movements so it carries its own navigation with it.
A macro that saves wrote a file I did not expect
When a macro has a name and its recording includes a save, playback writes a copy beside the original, named after the macro with the batch number appended, and timestamped if that name is already taken. It does not silently overwrite your original. If macOS will not let the app write to that folder, you are told to use File ▸ Save As… once to grant access to it.
Stopping a run part-way through
Cancel Playback answers to a bare ⎋, so a long run is always one key away from stopping — useful the first time you set a new macro going across every open tab. While a run is under way, treat Escape as belonging to the macro, and reach for the window's own controls for anything else until it has finished. With a long repeat count and the delay raised a little, this is how you watch a run and take it back the moment you have seen enough.
Where a macro earns its keep
The best candidates are edits with a shape to them: a few movements and a change or two, repeated down a file. A handful worth recording once and keeping by name.
- Wrap and punctuate a line. Beginning of line, a quote, end of line, a quote and a comma, then down a line and back to the beginning. Four hundred lines in a single run.
- Strip a field. Jump a couple of words in, extend the selection to the end of the field, delete, then move on to the next line ready to go again.
- Re-shape a block. Select a run of lines and indent or outdent them, then step down to the next block that needs the same treatment.
- Travel by search. Find Next, edit whatever it landed on, Find Next again. Search steps record, so a macro can move through a file by what the file contains rather than by counting lines.
- Finish the file off. Convert line endings or encoding, rename the tab, save — the housekeeping at the end of a job, done the same way every time.
Give each macro one job and run it as often as the work needs. Two short recordings you understand at a glance are worth more than one long one you have to think about before every run, and the numbered step list in Manage Macros will remind you which is which weeks later.
Start with a run of one on real work, look at what it did, then set the repeat count high once you are happy. That is the whole rhythm: record once, check once, then let it do the four hundred.
Frequently asked questions
How do I start recording a macro on a Mac?
Press ⌥⌘R, or choose Macro ▸ Start Recording, or use the toggle in the toolbar's Macros pull-down. Stop with ⌥⇧⌘R. A pill with a pulsing red dot and a live action count confirms that recording is running.
How many actions can one macro hold?
As many as your edit takes — record the whole change in one pass and playback works through all of it. Set the run to repeat anywhere from 1 to 9,999 times, across the current tab or every open tab.
Can I undo a macro that went wrong?
Yes. One ⌘Z reverses a whole run — every action, across every repeat and every tab it touched. The Edit menu shows it as Undo Macro Playback.
Are my macros kept after I quit?
Saved ones are. They stay on your Mac — nothing is uploaded — and are in the Macro menu next time you open the app. A recording you chose not to save stays available as the current macro until you quit, and is then gone.
Can a macro run across several files at once?
Across several open tabs, yes: choose All Open Tabs in the Replay Macro sheet. It works through the tabs that were open when the run started, so the run stays inside the files you chose to open — and one ⌘Z still takes the whole thing back.
What does the beep during recording mean?
It is our macro recorder telling you, at the time, that a step wants a different route — the message "That action can't be recorded." appears with it. Adjust while the edit is fresh and carry on with a recording you can trust. The beep can be turned off in Settings ▸ Macros, and the message stays.