Jump to content
dfay

Finder scripts (including opening in a single window)

Recommended Posts

This is a workflow I've cobbled together from various sources, notably some modifications to https://github.com/NapoleonWils0n/bashfinder , which is actually a bash front end for a lot of AppleScript.

 

It contains the following commands:

 

fo - open a folder in the frontmost Finder window (also available as a File Action)

fo:i - open a folder in the frontmost Finder window with Icon view (also available as a File Action)

fo:c - open a folder in the frontmost Finder window with Column view (also available as a File Action)

fo:l - open a folder in the frontmost Finder window with List view (also available as a File Action)

all - open "All My Files" (Sierra) or "Recents" (High Sierra and later) in the frontmost Finder window - this uses a Key Combo action ⌘⇧F

icloud - open iCloud Drive in the frontmost Finder window - this uses a Key Combo action ⌘⇧I

 

rf - open a recent folder in the frontmost Finder window

fi - set frontmost Finder window to Icon view

fc - Set frontmost Finder window to Column view

fl - Set frontmost Finder window to List view

fg - Set frontmost Finder window to Gallery view (i.e. icon view with big icons and a dark background)

fw - Close frontmost window and reopen active tab (i.e. close all tabs except the active one)

merge - Merge All Windows (same as menu command)

fcfix - set filename column width to 400

clip - show the Finder clipboard (I bet you didn't know there was such a thing....)

 

There is a single environment variable: 

openInNewTab

set it to 0 to open in the frontmost window (replacing the existing contents) or 1 (the default setting) to open in a new tab in the frontmost window

 

By using fo and its variants, you can effectively have Alfred open folders in a single window as requested here: 

https://www.alfredforum.com/topic/11393-opening-folders-in-the-same-finder-window/?do=findComment&comment=59570

and here:

https://www.alfredforum.com/topic/11327-any-way-search-open-a-folder-in-same-finder-window/?tab=comments#comment-59276

 

v.0.4 (2018-08-06)

Added icloud and all keywords

 

v.0.3 (2018-04-08)

Added file actions

Added rf and fw keywords

 

v.0.2 (2018-04-06)

Added openInNewTab

 

Download:

https://www.dropbox.com/s/u1bchxchlm4c1q3/Finder scripts.alfredworkflow?dl=0

 

 

 

Edited by dfay

Share this post


Link to post

Yes.  I added an environment variable - it's set to use tabs by default since that's my preference.

 

Adding the AppleScript to take care of the new tabs (embedded in bashfinder.sh) took all of five minutes.  Trying to set the environment variable programmatically in bash took more than an hour and I gave up.  So at this point you need to set it manually.  

Edited by dfay

Share this post


Link to post

Thanks!  Since I set this up, it's probably become my most used workflow....but I had actually forgotten about the rf command so I'm glad you got my attention to look at the docs again!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...