[SOLVED] Variable MacName Fails to Return a Value

In one of my macros I am using the variable MacName. I have two Macs and one returns the computer correctly, but on the other it returns nothing (blank).

I have inserted a simple debugging action at the beginning of my macro to just display %Variable%MacName% in a window—and nothing is displayed.

The computer that returns a blank is a MacBook Pro 14" 2021. I have tried rename it (via System Preferences), restarting it, checking that Safari's "Allow Javascript from Apple Events" is activated, querying the computer name in the Terminal via "sudo scutil --get ComputerName" (returns the computer's name correctly). So now I am out of debugging ideas.

Does anybody have an idea what might be going on?

Hi @dano - welcome to the forum!

Firstly, MacName is a text token and not a variable so the correct way to use it it by writing %MacName%.

Have a look at the tokens page in the KM wiki here; Tokens [Keyboard Maestro Wiki]

2 Likes

Thanks for the reply. Again, it works on one computer (macros are synced) and not the other. This, see below, returns nothing (blank).

Like I said - you use it as %MacName% - you do not need the variable prefix. RTM

As @tiffle's keen eyes spotted -- you don't use %Variable with a token:

macName

Thanks folks!

Seems I had a variable named MacName, which was adding to my confusion.

1 Like