Ventura - Apple Script to select Time Machine menu

Hi

I have had help previously to select the BlueTooth menu which works successfully but I cannot get it to to work for opening the Time Machine window and select 'Open Time Machine Settings'. Here is what I am using for BlueTooth to connect my mouse :-

tell application "System Events"
	tell process "ControlCenter"
		set theMenu to item 1 of (get every menu bar item of menu bar 1 whose description is "Bluetooth")
		click theMenu
		click checkbox 2 of scroll area 1 of group 1 of window "Control Centre"
		delay 1
		click theMenu
	end tell
end tell

As ever, any help will be gratefully received,

Andrew

How about this?

Open Time Machine Settings.kmmacros (19 KB)

Macro screenshot

1 Like

Hi noisneil

Thanks for the quick replay and yes that works fine. The only minor problem is if TM is already 'open' but closed in the dock, how could I bring it to the front? I have tried adding 'Bring Application Windows to Front' and 'Show System Settings' but neither work.

Andrew

In other words, minimised?

Open Time Machine Settings.kmmacros (20 KB)

Macro screenshot

This will work even if a different System Preference pane is active when the macro is run and will work whether the window is minimised or not.

1 Like

While Neil’s suggestion is a good one, there’s a native way of doing this opening the preferences panes. This should open and bring to front TimeMachine preferences pane even if it’s already open, hidden, minimized etc.

EDIT: Beat me by one minute @noisneil :laughing:

Download Macro(s): Open TimeMachine.kmmacros (2.8 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.6
  • Keyboard Maestro v10.2
1 Like

Best of both:

Open Time Machine Settings.kmmacros (20 KB)

Macro screenshot

1 Like

I would swap the order of the two actions so it doesn’t fail if there aren’t any windows open already. :wink: (Or just disable the notification and failure aborts options, but I don’t like failure messages in my log at all haha)

Hi noisneil

Thank you again that all works great. Hopefully this will be useful to other users in the future.

Andrew

Hi cdthomer

I didn't realise it was a race :grinning:

Thank you for your contribution and I will change the action order as suggested. I have also learnt the function Unminimize in KM.

Andrew

It doesn't fail for me. :man_shrugging:t2:

But fair enough. Whatever works!

1 Like

Nonsense! It certainly does fail! :man_facepalming:t2:

And it fails if the Manipulate Window action is last if System Settings isn't currently running.

So, in my opinion, you should disable Failure Notifications for the Manipulate a Window action and call it a day.

1 Like

You are correct I have used your version unmodified. I just noticed 'window with title matching' is a full stop.

It turns out the action order doesn't matter; each has its failure points, but turning off failure notifications makes it a moot point (unless you have a thing for pristine logs...).

Yes, this is a regular expression that matches anything, which ensures that Sytem Settings is unminimised regardless of the window title (i.e. which preference pane is active).

This isn't needed if you use the action order proposed by @cdthomer, so you can do it that way round with an explicit window title if you like.

Open Time Machine Settings.kmmacros (20 KB)

Macro screenshot

1 Like

You must be new here... :wink:

Glad you got things going!

I have used KM for a few years but obviously I am slow learner. :stuck_out_tongue_winking_eye:

1 Like

It's the friendliest race in the world where everyone's a winner because even if they don't cross the finish line, they still qualify for next time, with everyone else cheering them on. I love this forum. :heart:

4 Likes

Hi again

I had a major crash on my MBP which took local Apple store some while to find (corrupt system and recovery software) and fixed by doing complete rebuild but unfortunately using Sonoma (I was running Ventura and those are my 3 TM Back Ups). Still trying to enable all the various permissions which I am still struggling with.

The point of this reply is the macro you uploaded no longer works as the open Time Machine preferences opens the 'General' panel of preferences. Any more thoughts to cure this?

Andrew

I’m still on Ventura (and from what I hear about Sonoma won’t be upgrading to it anytime soon, if at all), so I’m not sure what the issue might be. But there are a fair number of other members here that are on Sonoma and might pitch in soon.

Have you tried this (Open a System Preference Pane action)?

Hi

Yes I am using that and the suggested window shown here but bite only open panel not specific TM.
Screenshot 2023-11-05 at 09.12.53