How do I simulate a key press of a key (Eject key) I don't have?

My keyboard doesn't have the Eject key. Yet I've always used the ⌃-Eject combination to show the Sleep/Restart/Shutdown window on previous Macs. I want to simulate the key press by typing a different keyboard combination so that (hopefully) macOS will show me that window.

How can I do this?

You can always use the combination: "control+power button" to access this dialog box. If you are using a mac mini like me, this shortcut will however not be of much use to you.

I don't know if there is a way to create a shortcut button which will emulate either the eject or shut down button. I tried various different things like a keyboard shortcut for the power button and an automator workflow for the eject function but without any success so far.

I tried, and when I press the power button (which is Touch ID) with and without any modifier key it just locks the display :frowning: I'm using a MacBook Air M2.

this is no longer supported by the newer Macs. I solved this with an apple script. I found it online but can't remember the source. The display dialog command only supports three buttons, so one must be omitted. Pick your poison... in this example "restart ´" is not active. You can run the script with "Run Apple Script (async in background)" and a trigger of your choosing.

tell application "Finder" to activate

tell application "Finder"

display dialog "Are you sure you want to shut down your

computer now?" buttons {"Sleep", "Shut Down", "Cancel"} default button "Cancel" with icon caution

if button returned of result is "Shut Down" then

shut down

else if button returned of result is "Restart" then

restart

else if button returned of result is "Sleep" then

sleep

end if

end tell