Open a Smart Folder in Finder

I created several Smart Folders that I would like to open via KM macros. I can see these folders in the KM user interface as I build my macro, but KM won’t let me select any of these folders through the macro builder interface.

My ultimate use case: I would like to open my Downloads folder in Finder to see my recent files (today, through yesterday, and through last week). Smart Folders not only allow me to specify search criteria, they allow me to customize the Folder’s view, sort, and column properties. I see no way to customize my Finder display properties (view, sort, columns) through KM.

I’m a new user … so if the above question sounds whacky, that should explain why :smile:

1 Like

This Might help...
Auto Resize Finder Columns

Cheers...
Bill

Smart Folders are saved in a folder called "Saved Searches" in the User Library folder.

Add an "Open a File, Folder, or Application" action to your macro.

Paste this into the text box. Obviously, replace the stuff in caps with what yours say. :wink:
/Users/YOURUSERNAME/Library/Saved Searches/SMARTFOLDERNAME.savedSearch

And I don't know if this will help with what you're trying to do, but here's how I keep my sanity in Finder:

2 Likes

Hey bdurham,

Ace has shown that you can go to town setting the Finder view with KM. You can set the menu-state. You can also detect the menu state, so you're macro can make choices based in the current set-up if desired.

Smart folders need not show up in your Finder window side-bar. They can be hidden in the "Saved Searches" folder, so you can have as many as you want without cluttering the Finder.

In this use-case I'd rather use AppleScript than a KM-specific action, because I have more control over what the Finder does. In the macro below I'm setting the bounds of the window (position & size).

Run this from Script Editor.app to see what it does. Run in KM with an Execute an AppleScript action.

# User changes this name to suit:
set smartFolderName to "Pending.savedSearch"

set smartFolderDir to ((path to library folder from user domain as text) & "Saved Searches:")
set smartFolderPathHFS to smartFolderDir & smartFolderName

tell application "Finder"
  activate
  open alias smartFolderPathHFS
  set bounds of front window to {525, 45, 1395, 817}
end tell

-Chris
_____________________
KM 7.0.1 on OSX 10.10.5

Hey Chris, thanks for this.

I'm back to working with Saved Searches, and this is perfect for restoring one.

I don't understand the orientation of the set bounds of front window.
In KM, I move a window to 1261 over and 756 down which sets the upper left corner of the window. Then I resize to 617 wide by 684 tall. The same size and location in AS come out as {1261, 756, 1877, 1440}. The first two line up. What's the orientation for the width and height?

Hey Bern,

AppleScript bounds are:

{x1, y1, x2, y2}

Where the pair x1,y1 are the upper-left corner of the window and x2, y2 are the lower-right corner of the window.

You can run this in Script Debugger or the Apple Script Editor.app and move the front window around to see how the bounds change.

tell application "Finder"
   bounds of front window
end tell

-Chris

"Well, bust my buttons! Why didn't you say that in the first place? That's a horse of a different color!” :crystal_ball:

(Now the numbers make sense.) :pray:t3: