Make a ShutDown Button on Touch Bar
I wanted to reply to "Shortcut to shutdown on the new Macbook Pro Touch Bar running High Sierra?" (https://discussions.apple.com/thread/8285181) but Apple closes quite fast the discussion also when not resolved (why?), so I write a solution into a new post.
One option is to make a new button for the Touchbar. In the Touchbar is already a SleepButton as a customizable option, but we have to program a new one with QuickAction and Automator.
Open Automator,
- make a new "QuickAction". Select "no input" in "any application". I choose red as background color.
- search "run apple script" and double click it or drag it into the canvas to build the workflow.
- replace the default script with this one:
tell application "System Events"
set ProcNm_ to name of every application process whose visible is true
end tell
repeat with i_ from 1 to count items of ProcNm_
set TarProc_ to item i_ of ProcNm_
try
tell application TarProc_ to quit -- you can add "without saving" if you need no action!
end try
end repeat
tell application "System Events"
shut down
end tell
- Save
- Now, if not done before, include QuickActions in your Touchbar, activating it in System Preferences -Extensions - TouchBar, as explained in https://support.apple.com/guide/automator/use-quick-action-workflows-aut73234890a/mac. I have there also a "dark-undark"(mode)- button, a "copy path" and a "remove format". You can decide there the order of the buttons (just drag), and also assign this script to a button made with the third-party-app "BetterTouchTool".
The script was taken from "https://discussions.apple.com/thread/8263239", thanks acsrarmin. It is made to close first any applications.
Another option is to assign a key, as said in https://apple.stackexchange.com/questions/262027/keyboard-shortcut-for-powering-down-macbook-pro-with-touch-bar, but I haven't tested it (I tend to forget keystrokes on the long run).
PD: the assign-to-topic-logic Apple suggests now is really quite restricted. This relates to a series of devices (with touchbar), not a model, and not to a program, but the System itself. And not to one OS, but to several ones. This restriction to specific and so absurd reduced options makes the Apple Community Discussions no longer usable. I guess I won't use them again (there are enough other platforms) until Apple changes this.