Edit AllPages

I noticed that neither NSWorkspace nor NSFileManager appear to have any way with which to programatically display the Finder’s “Get Info” window. This seems a bit of an oversight (either on my part or on Apple’s, your pick!) so I present for your consumption a category off NSWorkspace for programmatically displaying said window given any file or folder path. As with other code I’ve posted here, I’ve used my own whitespace/brace style rather than Apple’s. -JonathanGrynspan


#import <Cocoa/Cocoa.h>

@interface NSWorkspace(GTAdditions) /* returns YES if the window was successfully displayed, NO otherwise */


#import “NSWorkspace+GTAdditions.h”

static NSString *getInfoScript = @”tell application ""\n” “open information window of %@ ("%@" as POSIX file)\n” “activate\n” “end tell”;

@implementation NSWorkspace (GTAdditions)

For most workspace related operations, Applescript tends to be the best to use - because of its wide range of functions. A lot of things missing from the NSWorkspace class are actually available via this method. Although not being the most desirable, it gets the job done. —-