Unknown macro - dashes-for-spaces in filenames -?

Hi and good day,

After a Clean Install of the Mac I’m now searching “for my lost macro” = a pearl:

It allows the user to step-by-step insert a dash “ - “ at every space in the file name.

(Rename - ENTER, the clicking on the filename).

See here:

I use it holding down SH - ALT - CMD and " - ", it automatically finds the next space, and I press the " - " again, it's very intuitiv.

This macro is not in my KM list of macros, but I still can use it on the SUperduper-CLONE.

Maybe someone on the forum knows/ uses this macro and can tell me at least where to look on the clone-HD.

Nothing on the net - for manual insert.

with best regards,
Omar KN
Stockholm, Sweden

I'm not sure I understand you, but if "SUperduper-CLONE" is another Mac, or another startup disk for your Mac, then this should work:

  1. Startup/Login to "SUperduper-CLONE"
  2. Trigger the lost macro
  3. Open the Keyboard Maestro.app (editor)
  4. Select the unknown Macro from the list of Recently Run Macros:
  5. Select the Macro in the Macro List panel, and export Macro to an external drive (like a USB drive)
  6. Log out of this Mac, and log in to your new "Clean Install Mac".
  7. Import the macro from Step #5


If my above instructions do not allow you to recover your Macro, here is a similar Macro that I use all the time. I believe it is much simpler:

  • Select the file in the Finder, or Path Finder, list view
  • Trigger the macro
  • It replaces all spaces in the file name with a dash ("-")

MACRO:   Replace Spaces with Dashes in File Name in @Finder @PF

~~~ VER: 1.0    2019-02-24 ~~~


Replace Spaces with Dashes in File Name in @Finder @PF.kmmacros (4.8 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


Hi JMichaelTX,

Thank you for the input.

  • The 'lost macro' was not part of my KM macros, it still exists on the external disk (SuperDuper- Clone). I got it from (?) years ago, don't remember how it was set on my machine - mysterious.

  • Great that you came up with this KM macro above ” Replace Spaces with Dashes…” however when selecting a (read & write) file and triggering the macro -> error: Not permitted, Library to Library??

See here:


… ?!


with best regards,
Omar KN
Stockholm, Sweden

Hey Omar,

Boot from your SuperDuper Clone drive.

Open the Keyboard Maestro Editor.

Select the “All Macros” group.

Select Menu Item: View > Sort Macros By > Date Used

Run your macro.

Switch back to the Keyboard Maestro Editor with the SYSTEM app-switcher or the Dock.

Your just run macro should be at the top of the list in the Keyboard Maestro Editor.


Thank you Chris, I did exactly that but nothing there!

Now I could just wait for JMichaelTX's macro to work (above 4/5), a macro which probably is even better than my old one…

…but I cannot wrap my head around the fact that on the SuperDuper Clone drive there is a working macro (not in KM list) which is working there for ≈ 4 or 5 years 'incognito'!

It has to be somewhere and what is special is that 3 keys are pressed down, and then the 4th key (the dash) is also pressed (video above). This is bugging me.

There should be other people / web designers etc. who use it.


with best regards,
Omar KN
Stockholm, Sweden

I don't think you triggered my macro. It does NOT use the "mv: rename" command shown in your Notification:


Also, I just tested my macro using a folder inside of the /Library folder, and it worked fine, even though I had to enter my Mac password.

Here is the KM Engine log from my test:

Execute macro “Replace Spaces with Dashes in File Name in @Finder @PF” from trigger Duplicate Macro Palette

Are you running Mojave by chance? That could cause problems between KM and the Finder with permissions.

Hi JMichaelTX ,

Your macro (above #3) does function alright, thank you!

Another script (shell~), to apparently do the same is what I found on the web:

Replace spaces with hyphens in Mac file names:

for i in *; do mv "$i" "echo $i | sed -e 's, ,-,g'"; done

But how to clad this script into a shell - ?

PS: But your macro is fine, which will do - !

Hey Omar,

You ran the test when booted from the SuperDuper volume?


The only logical conclusion is that either you're missing seeing the macro in the Keyboard Maestro – OR Keyboard Maestro is not the agent running the macro.

Quit the Keyboard Maestro Engine and try again on the SuperDuper volume.

Report back.


Started from the clone,

Quit KM engine,

Tried the unknown macro,

it worked => it's not a KM macro.

Also remarkable it's working with 3 keys down + 1 key step bey step: this is not like usual 1 trigger macros. It must be some other script, where could it be stored?


Hi @JMichaelTX et al.

I wanted to adapt this macro ( Replace Spaces with Dashes in File Name in @Finder @PF) to use it with ForkLift instead of PathFinder:

So the original filename in ForkLift:

heavy wheather crisflo.txt

is changed to:


Path (has dashes after running the macro):


Why would the macro pick up the path and paste it in front of the filename - with another .txt?

Can you test it please (if you have ForkLift).

/ okn

I don't have ForkLift. Are the manual steps to rename a file in FortLift the same as in Finder? If not, could you make an animated GIF to show you doing the rename manually?

They are almost the same as PF: Commands > Rename

It's as if there's something (the path of this file) in the clipboard?!?


@okn thanks for the screenshot, but the reason I asked for:

is so I can see ALL steps you make, including the part where the current name is selected and you type/edit the name.
If you don't know how to make an animated GIF, just do a simple video. You can also search for tools to make it. Here's an example with Finder:


I used SnagIT to create the video and convert to GIF.

Alright here is an animated Gif : Renaming+dashes-on-filename-inForkLift.gif

Same after reboot.
Hope you can get an idea what's going on here.

/ okn

Yep, I can. You are NOT triggering my macro, or my modified macro.
Whatever you are doing is getting the file path and pasting that.

Assign my macro a different hotkey, and try again.

... but why then were all spaces replaced with dashes (apart of pasting the path)?

/ okn

Hey @JMichaelTX,

It looks like he is in fact triggering your macro.

The trouble is that copy was being actuated before the rename command finished, so the file was being copied.

When pasted back into a text field it produces a text-path.

Hey @okn,

Try this one.

I've introduced a short pause after the rename command.

Replace Spaces with Dashes in File Name in @Finder @PF @ccstone.kmmacros (8.1 KB)


Hey Omar,

Can you zip and post the Automator workflow file for this?

And – do you have a good reason for incrementing the replacement of the next space instead of replacing all spaces at once?



The famous, excellent Pause!

A pause of 0.15 seconds made all the difference.

And a reminder that we all do well with some pauses at the right moments! :slight_smile:

/ okn

1 Like