"Restart Computer" action, but without windows reopening?

When you manually restart Mac OS, it displays a checkbox allowing you to select or deselect "Reopen windows when logging back in." (And it remembers this selection, I'm pretty sure.)

When you use KM's "Restart Computer" action, it seems to default to windows reopening, without giving you another option, which is a problem if you prefer windows being closed upon restart.

Is there any way around this?

Hi, @alexcr. I'm using:

• Keyboard Maestro 10.2
• Sonoma beta 14.1 (23B5056e)/MacBookPro16,1

This works for me.

Select or Show a Menu Item.kmactions (720 B)

Keyboard Maestro Export

Thanks, Jim! And I suppose you can add a "Return" keystroke action at the end of this if you want to skip through the dialogue that follows and head right into the restart?

1 Like

You could probably do that. I usually use AppleScript for that kind of automation. This works for me:

tell application "System Events"
	tell application process "loginwindow"
		repeat until exists button "Restart" of window 1
			delay 0.1
		end repeat
		click button "Restart" of window 1
	end tell
end tell
4 Likes