Pages, Numbers and Keynote Macro Breaking Changes

Just a note to warn people if they have macros relating to the now Apple Creative Studio absorbed apps like Pages, Numbers and Keynote, these are essentially new apps.

The “old versions” (14.5) and the new versions (15.x onwards) are actually completely different apps. They look the same, the name appears as “Keynote” in the Applications folder, but they have different files names ("Keynote Creator Suite.app") and different Bundle IDs, so they are entirely different apps (with the same displayed name, sigh) as far as Keyboard Maestro is concerned. So macros or macro groups that refer to them will not refer automatically to the new version (since the file name and bundle ID are different, no setting in the application popup menu will allow it to refer to both.

You will also see this in things like the Dock where the icon may break for example.

10 Likes

Yes, I was confused at first. I had to go through all my applicable macros and add the new apps. It is especially confusing when there are places within the macro (such as choosing menu items or controlling apps) where you have to change each action. At least the icons are different so it’s easier to see which one you are choosing. The biggest problem, though, is in using AppleScripts. I had to delete my old Numbers app because all the scripts would try to act on the old app rather than the new one. Does anyone know how to fix scripts in this instance? How would you script “tell application “Numbers”” to use the correct app?

Try tell application id "com.apple.Keynote" instead of just tell application "Keynote". You can target the old Keynote with tell application id "com.apple.iWork.Keynote".

If you ever want to find an app's bundle identifier, you need to open Terminal, then do this:

$ cd /Applications
$ mdls -name kMDItemCFBundleIdentifier -r  "NameOfAppAsDisplayed.app"

That should return a form of com.whatever.whatever, and that's the bundle identifier. I wrote a simple macro that returns the bundle ID for whatever app I have selected in Finder, as I do this a lot :).

-rob.

3 Likes

Or as an AppleScript (run from Script Editor, a KM AS Action, whatever) that will set the System Clipboard ready for you to paste:

set the clipboard to (get id of (choose application with prompt "Select an app to get the Bundle ID of:"))
5 Likes

Tried this to open the app from the Dock, but

tell application "System Events"
	tell application process "Dock"
		tell list 1
			-- tell (first UI element whose name is "Numbers")
     tell application id "com.apple.Numbers"
				perform action "AXPress"
			end tell
		end tell
	end tell
end tell

because it is a UI element, how to write this?


This didn't work either

tell application "System Events"
	tell application process "Dock"
		tell list 1
			tell (first UI element whose name is "com.apple.Numbers")
				
				perform action "AXPress"
			end tell
		end tell
	end tell
end tell

System Events got an error: Can't get Ul element 1 of list 1 of application process "Dock" whose name = "com.apple.Numbers".

Invalid index.

/okn

Is there a particular reason you need to open the app from the Dock? That seems like a very complicated way to do it.

If you do, I honestly had no idea how to reference a UI element for a Dock item by bundle ID, so I asked an AI. It said this would work:

tell application "System Events"
    tell application process "Dock"
        tell list 1
            tell (first UI element whose value of attribute "AXURL" contains "com.apple.Numbers")
                perform action "AXPress"
            end tell
        end tell
    end tell
end tell

I haven't tested it myself, as I'm more interested in why the Dock is involved at all? Are you just trying to launch the app, or is there more to it than that?

-rob.

The UI elements of the Dock don't have bundle IDs as either properties or attribute values, so you can't target them in this way.

You can do

tell application "System Events"
	tell process "Dock"
		tell item 1 of (every UI element of list 1 whose name is "Finder") to click
	end tell
end tell

...although that will require unique element names.

Using AXURL as @griffman's AI buddy suggests might work -- except the value is a file path and not a bundle ID.

And I have to echo @griffman -- why do this in such a complicated way? What do you need to do that's only available via the Dock UI and no other way?

This didn't work anyway

error "System Events got an error: Can’t get UI element 1 of list 1 of application process \"Dock\" whose name = \"com.apple.Numbers\". Invalid index." number -1719

Yes, it is much easier to launch an app directly from Applications, and with Numbers:
/Applications/Numbers Creator Studio.app
+
with
Type the ⌘N Keystroke

because of the new UI, an extra step to avoid.

/okn

Argh… Before manually changing hundreds of references to “Numbers” I was wondering if there is any workaround to effect a “Find/Replace” type function in KeyMaestro?

In Script Editor 2.11 (233) for Apple Script 2.8 (which comes with macOS 26.3), entering

tell application “Numbers”
	activate
end tell

automatically substitutes “Numbers Creator Studio” on compilation, thus

tell application "Numbers Creator Studio"
	activate
end tell

This “substitution” simplifies updating Execute Applescript {as Text Script} steps which refer to “Numbers” multiple times: copy the script to the editor, recompile it, copy it back. (For shorter scripts simply replacing “Numbers” by “Numbers Creator Studio” works as well.)

Not really, no.

If you are very brave, you can quit Keyboard Maestro and Keyboard Maestro Engine, and you use BBEdit to search and replace in the Keyboard Maestro Macros.plist XML file.