MACRO: Make Macro Alias

No problem. Thanks for trying it.

What version of OS/X are you on?


Dang. I have no idea.

Well, it’s not that important. Keep using v1.0 with the pause set to whatever you need.

I’ll think on it a while. As I said, it’s not that important, but this kind of stuff drives me crazy (as you can tell by how quickly I responded). It’s like an itch I can’t ignore for long. :slight_smile:

Thanks for your help! I truly appreciate it. Most people usually just give up when there’s an issue, and the developer never knows about it. (Been guilty of doing that many times myself, as a user. :open_mouth: )

FWIW, when ScriptDebugger attempts to compile the script in “put the new macro on the clipboard, as an actual macro…” the compile fails at this line

set {_object, _error} to current application's NSPropertyListSerialization's propertyListWithData:_data options:0 format:(missing value) |error|:(reference)

with this error

Expected end of line, etc. but found “:”.

There may be other compilation errors in other actions, btw – didn’t check every possible compilation

It’s always a good idea when writing macros to run included code through Script Editor or ScriptDebugger to track errors, since KM does not throw useful messages about these things

I know, believe me. It’s what I do first. The thing is, I don’t get these errors on my system.

Just for kicks, here’s another version. This one doesn’t use AppleScript to check for the clipboard “set” to complete. Instead, it uses a Swift script.

[attachment removed]

Yeah, that one works, Thanks.

You might want to change the internal documentation in the macro (version number) or delete the previous versions

Definitely. In fact, I’ll delete it from the post. I just wanted to see if it worked. I should probably have replied privately.

Anyway, thanks for playing the game! :slight_smile:

Dan, one question about the alias name.

I notice in your GIF that you remove the word “alias” after the alias macro is created, thus having both the original and alias with the same, exact macro name.

Is there any danger of these being confused by other actions because they have the same name?

By other actions? No. By me? Absolutely. :slight_smile:

As you probably know, any references to macros in KM are by the macro’s UUID (unique identifier), which is why, when you change the name of a macro, all references to it change also.

So having more than one macro with the same name is OK, as far as KM is concerned. If you have any AppleScript or JXA code that relies on the macro’s name (which you shouldn’t), then that could be an issue.

This can get dicey if you do the following, which I’ve done more than once:

  1. Duplicate a macro, so I can keep the original version while making changes.
  2. Change the “copy” macro, and get it working.
  3. Delete the original macro, and rename the “copy” macro.

If the macro was used as a sub-macro, you just broke your references to it. Moral of this story is to save a copy, that’s always a good idea, but make your changes in the original version (unless it’s on a timer and might get launched while you’re working on it, in which case, you’re on your own). :slight_smile:

Probably more info than you wanted, but that’s better than less, right?

1 Like

Nope, just right.

One thing I have noticed, is that if I change the name of a sub-macro, it is automatically changed in all macros that call it.

1 Like

Right - as @DanThomas points out, Keyboard Maestro refers to the macros by UUID. Keyboard Maestro doesn’t care what you name your macros, you can name them all “A” if you want. You’ll get confused, but Keyboard Maestro wont.

Suh-Weet! Dan. By the way, what did you use to create the GIF of the movie? This is an excellent way to demonstrate “HowTOs”. I may have to steal it! Heh!

All of us JM. I can’t keep up with his ‘production’.[quote=“NaOH, post:3, topic:4139”]
I just Option-Drag
True. However, you can’t dispute the artful beauty and craftiness of Dan’s example. It’s like robotics where the robot builds itself.

…and since you pointed out that the UUID is no longer unique when calling from AppleScript, this might actually present an occasional issue which this avoids.

+1 :thumbsup:
p.s. I am really starting to dig Discourse a lot!

Yet another roadsign telling me I really need to start learning JavaScript/JXA.[quote=“DanThomas, post:16, topic:4139”]
that’s in JXA. I already know how to do that. Let’s continue this in the other topic.
Linkage please!

Ah! Handy information.

I don’t know what Dan used to create the animated GIF, but here is a decent, free, tool that I often use:

Thanks JM! I’ll check it out.

I’ve begun posting my JXA stuff here:

Thanks Dan!

I need to find some good sites on getting started with JavaScript/JXA. I am assuming that JXA is Apple’s implementation of JavaScript in MacOS. Are there any differences or is JavaScript pretty much the same when using JXA?

That would be wonderful Peter I am all for it!

Just noticed this nice macro from Dan!
Is there any development going? Dan or Peter (integrate it in KM)?

It would be great to see if this macro could also:

  • ask where to place aliases
  • rename it to the name of the original macro
  • work with multiple selection

Yes, it is on the todo list. It might make it in to 8.0, or not. @DanThomas is really good at extending Keyboard Maestro - I’m not sure I’ll be able to implement everything he’s done, and that’s probably just fine.

Yes, there is plenty of development going on, but since I am now hard at work on 8.0 it will be some time before it sees the light of day. I drop teasers on Twitter sometimes, and might here as well occasionally.

I may do things differently, maybe I will do something like allow a macro to be dragged in to an action list.

In the mean time, enjoy all of Dan’s hard work!