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.

Using Automator to quit Finder

Hello,

I recently became a user of Pathfinder and it quite effectively replaces the functionality (and then some) of Finder. So I've been trying to build an Automator script to automatically quit Finder at login.

I have successfully done this, sort of.

I have created a workflow (listed at the bottom of this thread) that I saved as an app and set up as a login item on my profile. I also have it saved as a workflow. It's built to quit finder, then remove it from the dock.

Here's the strange part:

1) when I run the app manually (or automatically as a login item), it kills Finder but won't remove it from the dock
2) when I run the workflow manually, it kills Finder and removes it from the dock
3) when I set up the workflow as a login item, Automator just opens and the process doesn't run

Admittedly, I pieced together the workflow by finding various components in different forums, so it is far from original work

Also, is it possible to have Automator run in the background when this script runs?

Here's the workflow (2 elements); any suggestions are appreciated:


***

Run Shell Script (this kills Finder)

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


Run AppleScript (this removes Finder from dock)

on run {input, parameters}
tell application "System Events" to tell process "Dock"
tell UI element "Finder" of list 1
perform action "AXShowMenu"
click menu item "Remove from Dock" of menu 1
end tell
end tell
return input
end run

***

iMac 20" Intel Core 2 Duo 2.4GHz, Mac OS X (10.5.8), 2GB RAM

Posted on Mar 10, 2010 12:33 AM

Reply
6 replies

Mar 10, 2010 6:40 PM in response to Steve Gallant

You might try putting in a short delay after telling the Finder to quit. Not quite sure what the cat command is doing in there either.

Automator doesn't run in the background, but for something like this you don't really need it at all - instead of using Automator to run shell scripts that run AppleScript, you can just put the whole thing into a single AppleScript.

Mar 11, 2010 9:29 AM in response to Steve Gallant

Steve Gallant wrote:
Hello,

I recently became a user of Pathfinder and it quite effectively replaces the functionality (and then some) of Finder. So I've been trying to build an Automator script to automatically quit Finder at login.


Doesn't Path Finder automatically quit Finder for you when you launch it? Path Finder does do this for me. Instead of trying to do this with Automator, you could just make Path Finder a login item, and then Finder will be closed for you upon login.

Oct 5, 2016 10:10 PM in response to Steve Gallant

Yes, Me too, Steve. But I ran into an odder issue.


Opened that issue in reply to Leviepex's informative 'A method to quit all apps at once'. Linking here, from there. And then returning here, to try and make more sense of an apparent bug demonstrated by Apple and by off-world apps.


The issue is behavior demonstrating Finder security, and the manner in which AppleScripts 'Quit All Applications' removes Finder stability. Pathfinder app also elicits the same system instability. The alarming behavior is vanishing Dock and Menu Bar. Sometimes, after quit all with an Apple app open (Text Edit) and an item in Trash (a web page, say) Menu Bar remains hidden until Finder icon is clicked. Of course, where Pathfinder removes Finder presence, a system crash occurs, meaning manual ⎋ reboot, rather than just the Apple app closed followed by clicking Finder. Pathfinder and AppleScript 'Quit All Applications' seem to be activating the same or similar bug here.


A solution appears to lie in engaging Trash and adding your osascript manipulation, as follows.


  • Utilities > Quit All Applications
  • Utilities > Run AppleScripttell application "Finder"
    empty the trash
    end tell
  • Utilities > Run AppleScript
    cat
    osascript -e 'tell application "Finder" to quit'
  • Save Automator Application as something or other... yes?

When this solution is applied, the erratic and inconsistent disappearance of Dock and Menu Bar ends.

Not sure what that means, except that I got lucky, maybe. DOS 4.2 got kinky like this in parent-child batch runtimes back in the 80's. Let's hope Apple covers that hole. Quick! Or whenever...


Using Automator to quit Finder
A method to quit all apps at once Emptying the trash automatically
Using Automator to quit Finder

Oct 7, 2016 1:53 AM in response to Osiyo

Except that Finder Inspector fails to close, and may cause an error popup under two conditions that I have identified on a Mac with a 2016 logic board that blocks DIMM slot 1! Thus, Inspector issue may indicate a 'marginal' machine capability, or a more interesting Automator development issue, if you and others on healthy machines run into the same Inspector reluctance to close.

  1. Where Safari is open and Finder is viewing a folder, only Safari closes - Inspector and Finder folder view remain open.
  2. Where any other app than Safari is open, and a Finder folder view is open, beside any other open app than Safari, there is an error popup 'Finder was unable to compete the close action', and Finder Inspector is still open.
  3. Where any other app than Safari is open, if Finder Inspector is the only Finder Window active, there is an error popup 'Finder was unable to compete the close action', and Finder Inspector is still open.

Using Automator to quit Finder

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