Kind condition not properly matching applications

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

It seems as if the current preset for Application in Hazel's Kind condition does not match all applications properly. Selecting that preset doesn't seem to match certain applications, specifically those that are run as background-only (setting LSUIElement to 1 in Info.plist) and those in the Trash.

If you select Other... and then find the Application Kind in that dialog, Hazel will work as expected, so that's a valid workaround, as is just matching based on the extension of a file being .app.

If it makes a difference, I'm using Mac OS X 10.6.2.
holigen
 
Posts: 18
Joined: Tue Mar 16, 2010 2:43 am

I'll look into it but I believe apps in the trash aren't considered to be installed anymore. Also, do you find this is happening with specific apps and if so, which ones?
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I'll look into it but I believe apps in the trash aren't considered to be installed anymore.


Well, that makes sense to me. I just ran into the issue when I was trying to get the login item script working. I ended up working around it, but I thought I would bring the issue to your attention regardless.

Mr_Noodle wrote:Also, do you find this is happening with specific apps and if so, which ones?


The application that wasn't working in the Trash was Coda, by Panic, Inc. The applications that didn't show up when I pointed Hazel at my Applications folder and told it to match all Applications (using the preset in the Kind rule) were Address Book, by Apple, Inc. and LaunchBar, by Objective Development Software GmbH, which was set to not show up in the Dock (it modifies its own application bundle as a preference, to change the value of LSUIElement in the Info.plist to 1). That's probably what's keeping Hazel from matching it, but when you select the Application kind manually (by selecting Other... first), it does match Address Book and LaunchBar.

As for Address Book, I have no idea why that wouldn't be matching.
holigen
 
Posts: 18
Joined: Tue Mar 16, 2010 2:43 am

Could you provide 'mdls' dumps of both an app that matches and one that doesn't? Thanks.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Could you provide 'mdls' dumps of both an app that matches and one that doesn't?


Sure, here's the mdls output of Address Book:

Code: Select all
kMDItemContentType         = ""
kMDItemFSContentChangeDate = 2009-07-24 22:36:53 -0700
kMDItemFSCreationDate      = 2009-07-24 22:36:53 -0700
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "Address Book.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 0
kMDItemFSOwnerUserID       = 0
kMDItemFSSize              = 0
kMDItemFSTypeCode          = ""
kMDItemLastUsedDate        = 2010-03-13 15:03:04 -0700
kMDItemUsedDates           = (
    "2009-08-28 00:00:00 -0700",
    "2009-08-29 00:00:00 -0700",
    "2009-09-07 21:00:00 -0700",
    "2009-09-17 21:00:00 -0700",
    "2009-09-18 21:00:00 -0700",
    "2009-09-29 21:00:00 -0700",
    "2009-10-06 21:00:00 -0700",
    "2010-01-05 22:00:00 -0700",
    "2010-01-16 00:00:00 -0700",
    "2010-01-17 00:00:00 -0700",
    "2010-03-04 00:00:00 -0700",
    "2010-03-05 00:00:00 -0700",
    "2010-03-10 00:00:00 -0700",
    "2010-03-13 00:00:00 -0700"
)


And here's the mdls output of Automator:

Code: Select all
kMDItemAlternateNames          = (
    "Automator.app"
)
kMDItemCFBundleIdentifier      = "com.apple.Automator"
kMDItemContentCreationDate     = 2009-07-11 00:09:48 -0700
kMDItemContentModificationDate = 2009-07-11 00:09:48 -0700
kMDItemContentType             = "com.apple.application-bundle"
kMDItemContentTypeTree         = (
    "com.apple.application-bundle",
    "com.apple.application",
    "public.executable",
    "com.apple.bundle",
    "public.directory",
    "public.item",
    "com.apple.package"
)
kMDItemDisplayName             = "Automator"
kMDItemFSContentChangeDate     = 2009-07-11 00:09:48 -0700
kMDItemFSCreationDate          = 2009-07-11 00:09:48 -0700
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = 0
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "Automator.app"
kMDItemFSNodeCount             = 1
kMDItemFSOwnerGroupID          = 0
kMDItemFSOwnerUserID           = 0
kMDItemFSSize                  = 0
kMDItemFSTypeCode              = ""
kMDItemKind                    = "Application"
kMDItemLanguages               = (
    English
)
kMDItemLastUsedDate            = 2010-03-10 13:19:43 -0700
kMDItemUsedDates               = (
    "2009-08-31 00:00:00 -0700",
    "2009-09-08 21:00:00 -0700",
    "2009-09-15 21:00:00 -0700",
    "2009-09-18 21:00:00 -0700",
    "2009-10-09 21:00:00 -0700",
    "2010-01-15 00:00:00 -0700",
    "2010-01-16 00:00:00 -0700",
    "2010-03-02 00:00:00 -0700",
    "2010-03-10 00:00:00 -0700"
)
kMDItemVersion                 = "2.1"


Just for good measure, here's the mdls output of LaunchBar as well:

Code: Select all
kMDItemFSContentChangeDate = 2009-11-10 06:13:02 -0700
kMDItemFSCreationDate      = 2009-11-04 01:26:07 -0700
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "LaunchBar.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 20
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 0
kMDItemFSTypeCode          = ""
kMDItemLastUsedDate        = 2009-11-09 22:03:52 -0700
kMDItemUsedDates           = (
    "2009-11-09 22:00:00 -0700"
)


Right off the bat, I can see that both Address Book's and LaunchBar's metadata are not correct -- there's no indication that either are an application bundle. It's strange, though, that manually selecting the Application kind would label it as an application, despite the lack of metadata to support that.

I don't think this is really a problem with Hazel, actually.
holigen
 
Posts: 18
Joined: Tue Mar 16, 2010 2:43 am

Ah, that makes more sense now. For whatever reason, AddressBook and LaunchBar aren't being indexed by Spotlight. You can try using 'mdimport' to reindex them. Hazel does some heuristics to try and match "Kind" when there is no Spotlight data for it by consulting LaunchServices but it doesn't go as far as reconstructing the UTI tree necessary for it to match what Spotlight provides.

That said, I'm not sure why it would work when you selected "Kind" in the "Other" list since that mechanism is solely Spotlight based.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support