You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator quit all

I want a script to close all open applications and empty trash.


Applications and Finder behave differently.

Automator 'Utilities' options appear the best bet, so I am focused there.

I am able to quit all applications, but Finder is stubborn

I can close Finder components as a group inside Automator, but combining that group with 'Quit all Applications' The Automator group of scripts fails to close Finder components (Finder window, Get info, and Inspector).

Here's what I have so far.


Group 1: on it's own closes everything but Finder stuff.

Utilities > Quit all applications

Quit all applications

Group 2: this group works well.

Utilities > Run AppleScript

on run {input, parameters}

tell application "Finder"

empty the trash

end tell

delay 1

return input

end run

Group 3: run on its own this works, but not with 'Quit All Applications'.

Utilities > Run AppleScript

on run {input, parameters}

tell application "Finder"

activate

quit

delay 3

tell application "Finder"

activate

end tell

end tell

return input

end run

Group 4: this one works on its own for Finder stuff, but doesn't work with other groups.

Utilities > Run Shell Script

cat

osascript -e 'tell application "Finder" to quit'

Mac Pro, OS X El Capitan (10.11.6), MacBook Pro - iPhone6+ - Power PC

Posted on Oct 7, 2016 6:04 AM

Reply
22 replies

Nov 26, 2016 3:48 PM in response to Osiyo

Osiyo wrote:


Look, grumpy old man. No errors!

So. You are still doing everything twice for no reason. If it does it once without error, what is so impressive that it completes the same exact task with no error?

Again, just wasting processing cycles.


Is your point to just post a lot of crappy code, or did you want to learn how to program using Automator and AppleScript?

Nov 27, 2016 12:11 AM in response to Barney-15E

When "input" included, no error - 128.

When "input" not included, error - 128, also 52, depending, error regardless.

Why not use "input"? I dont understand you.

Apple Automator template for Utilities › Run AppleScript spells it out.


on run {input, parameters}


(* Your script goes here *)


return input

end run

Barney-15E, please stop wasting space in this forum with your inane, irrelevant comments.

Nov 27, 2016 6:34 AM in response to Osiyo

You don't need to return anything as you are not using it on subsequent Actions.

It is included in the template because it is assumed that an Action will pass on what it got in. You neither get anything in, nor use it in subsequent Actions, so it is superfluous.


The -128 error is generated by AppleScript when you try to empty an empty trash can. Just don't do that and you won't get any error. The error has nothing to do with what you return out of the AppleScript Run handler.

Automator quit all

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.