Programmatically determine 'pathbarVisible' for a Finder window

107 views Asked by At

I'm using OS X Objective-C in Xcode 6.1 and the Scripting Bridge to create a Finder utility. I have built and utilized Finder.h for the Scripting Bridge using terminal with the following command:

sdef /System/Library/CoreServices/Finder.app | sdp -fh --basename Finder

The utility I'm writing needs to determine programmatically the visual edges of a given Finder window. The presence of a status bar and/or a path bar affect the 'size' as determined by the 'edges' of a given Finder window as it appears on screen.

The status bar and the path bar are not included in the in the 'bounds' property as reported by the Scripting Bridge (Finder.h). I have successfully utilized 'statusbarVisible' included in the Finder.h header to determine whether or not the status bar is showing. However it seems if the path bar is showing, that also affects the visible size/edges and I do not see any property to report 'pathbarVisible'.

Is there some equivalent to 'statusbarVisible' to determine if the path bar is visible for a given Finder Window?? Or is there another way to get this information that does not require the Scripting Bridge?

1

There are 1 answers

0
Chris N On

Finder doesn't appear to have a property that directly tells you whether or not the path bar is visible, so there's no easy solution. The best I can think of is to use Accessibility to probe the window and see if the path bar elements are there or not. You can do that using System Events' GUI scripting suite (presumably using Scripting Bridge), or you can use Accessibility directly, since that's what the GUI scripting suite is implemented in terms of.