Problem switching between 2 startup disks (v11.0.2)

Keyboard Maestro Export

The attached macro is my attempt to make a macro to quickly switch between 2 startup disks, but I ran into several problems. Namely, I could not find a way

  1. to execute the required steps by keyboard
  2. to choose which startup disk to use

So, I ended up using image recognition for (1) and that worked okay. I suppose I could use that choosing the startup disk, but it all seems so awkward.

There's a "keyboard navigation" toggle in Settings -- I tried both and neither gave me the keyboard control I needed.

In the end, it all became so complicated that it's much easier just to hold the power button while restarting and select the startup disk manually, even if it does requires some extra waiting and staring at the screen.

I'm using a M3 Mac Air running Mac OS 14.4.1 and KM 11.0.2

Thanks for any help
change startup disk.kmmacros (16.5 KB)

It seems to me that you uploaded only one action, not the entire macro. This is understandable, as it's easy to click on the wrong thing when using the Share menu item.

Thank you, @Airy -- yes, it was my first time using the "Share" feature to share a macro with the forum. So, instead now I've used file>export instead and I think I did it right

I have only one disk, so I can't validate that it works. I'm not sure how it would "switch." I don't see any code in there that would "switch," all I see is code that would "restart."

One small improvement I would make is to add a second Click action at the bottom of your macro that would use the "dark mode" version of the Restart Button. If the first one fails, the second one would work. You can capture the image yourself by setting your screen to Dark Mode.

I wish to tell you that the bitmap image in your final action may not work for other people, due to screen scaling settings. I use a non-default setting, and so the action you created will not work for me. If you really wanted your macro to work for other people, you may have to capture several different rectangles for both dark mode and light mode.

Actually, my goal was not to search screen images at all. I'm aware of some of their problems and you've helped me to see even more of their problems. I only resort to using them when I can't work out any other way. I figured somebody else might know a better way.

The arrow keys work for me to switch between the drives available to boot, but that may rely on having "Full keyboard access" enabled, which allows tabbing to everything, basically. However, the bigger issue you'll run into is that you need admin permission to change the boot drive, so as soon as you switch it, a password dialog appears.

-rob.

There are better ways than screenshots. Here's one of them. Try it out in your macro.

But be warned, those three periods are not three periods, they are a single character!

1 Like

I wanted to assign the "Answer" to both @Airy and @griffman but couldn't see how to do that. So, I just gave to who was first.

The Accessibility: Full Access was definitely something I was looking for. But there are still 2 (unavoidable?) problems:

  1. although I can switch disks I don't know which to switch to since there is no Action telling me which disk is the current Startup Disk.
  2. having to enter the user password makes this kind of macro less useful

The Press Button action is really a nice alternative to scanning for an image -- but I wonder if it is just the same thing repackaged? Anyway, it's a great action and I really like how it populates the submenu so I don't have to type special characters like the elipses

Thanks for the great tips

Try this:
image

Execute an AppleScript.kmactions (911 Bytes)

You can tell the action to save the disk name to a variable if you want, rather than just display it as shown here.

@tiffle Thanks for providing this code. I tested it and it works.

I can see using text scripts like this is powerful. But how do mere mortals learn how to make them? And if there's one that does this, is there one that changes the startup disk?

Not that I'm aware of :frowning_face:

It used to be easy to change the startup disk. But now, with macOS' various protections, it's not really possible, as I understand it. The bless command in Terminal can do so, but only for external drives now. It used to "just work."

Sigh. Safer but less convenient :).

-rob.

Definitely not.

Thank you @Airy -- that gives me more confidence in using this feature.

I found it interesting that the scan feature did not recognize the two startup disk icons as buttons.

I'm not sure if that's clear so let me give more detail: if you have 2 startup disks then you will see icons for each of them in that section of the system settings. You click on which one you want (it becomes slightly highlighted) and then click the restart button below to restart using that disk.

But while the scan feature of the button click action recognizes the restart button, it does not recognize the two disk icons -- even though, like buttons, they can be clicked -- although they are simply used to indicate a selection rather than take some action immediately as with a button.

That's too bad because then it would make it simple for me to select which disk I want to start up with in the macro. Not being able to select those easily turned out to be a real problem.

As I said earlier, I gave up on this macro. But I sure learned a lot from all of you in the process. Thanks.

Yup. That's often a problem, even with some Apple apps. In this case, my guess is that Apple decided it can't be "buttonized" (hey, I coined a word) because Apple cannot guarantee that both drives will have different names, and buttons have to have different names. Or maybe it's because volume names can have non-ASCII characters, and button names are limited to ASCII?

It won't, because they aren't buttons. File icons in the Finder can also be clicked -- that doesn't make them buttons either!

As @griffman said, Apple have made it more and more difficult to switch startup disks in any way other than manually -- TBH, I'm impressed you got as far as you did. You might be able to go further with a combination of @tiffle's AppleScript to which drive is currently selected and image capture/OCR to work out what to select...

But why? What is it you're doing that requires switching so often that writing a macro is a worthwhile investment?

Yes @Nige_S you are absolutely right, and I have decided that it makes more sense to just switch discs the Apple Way (manually) as I mentioned earlier:

The reason I wanted to automate, was because I just got a new Mac and wanted to start completely fresh (reinstalling all software instead of copying from one of my CCC backups). But this is quite a chore so I also wanted access to the previous disk whenever needed. My new Mac has the space for this.

But just as important is that I want to become more savvy with Keyboard Maestro. I always thought it could do anything I envisioned, but was always limited by how inexperienced I was in using it. Only recently have I really spent the time to try to learn it better.

I'm starting to see that some tasks are a lot more challenging than others.

If this is more than a short-term thing, I'd consider setting my "old machine" up as a VM -- as an Apple Silicon user you don't need to splash out on Parallels or similar, you could try UTM or VirtualBuddy.

No better reason, IMO!

Or if you have the physical space for it, just leave it running somewhere in the house :). My old Core i9 iMac is chugging away in a corner, as it's the only way we can run older macOS (in VMWare Fusion) for customer support.

When I need it, I just screen share in.

-rob.