Rule matching kind = SketchUp document not working

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

Moderator: Mr_Noodle

I've created a rule to organize my CAD documents. It matches:

Kind is SketchUp document
Extension is dwg

Then it moves the files to a specific folder. The problem is, it only catches the *.dwg files. I've confirmed that the SketchUp documents have a 'kind' of SketchUp in Finder/Get Info. I've also tried removing the additional dwg rule to ensure that wasn't interfering.

Any suggestions?

Also, is there any way to view the UTI hierarchy for a particular type? i.e. if I've got a file of type jpeg, is there somewhere I can see it is both JPEG Image and Image?
colin_young
 
Posts: 5
Joined: Sat Jan 19, 2013 5:17 pm

Why not this?

Code: Select all
if (any) of the following conditions are met for (the file or folder being processed):
     extension is dwg
     extension is skp

Do the following to the matched file or folder:
     …
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Well yes, that probably would work, but it's not very elegant (or robust in the event that Trimble decides to change the extension for some future version).

Full disclosure: my day job is software development (Windows .Net) so I'm very curious about why it doesn't work.
colin_young
 
Posts: 5
Joined: Sat Jan 19, 2013 5:17 pm

At least on my machine, skp has been the extension for a the life of SketchUp. In the event they change extension, I'm sure they won't do it for every version update.

I'm unsure why Sketchup Document is not functioning, but I have in the past have had issues with the difference between metadata and ds store files. An example is finder comments and kMDItemFinderComment.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

In Hazel's preview, click on the "i" button there and see what the "Kind" is there. Also, check the logs and search for the file in question. Maybe it's matching but running into an error.
Mr_Noodle
Site Admin
 
Posts: 11951
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Changing extensions: yes, SketchUp has been stable, but that's just a specific example. Other extension might not be so stable.

Preview: It's coming up as "Document" in the Hazel preview. My (limited) understanding of the UTI system on OS X is that a file may have multiple types, based on a hierarchy of types. Finder sees it as "SketchUp" so clearly that's in the hierarchy somewhere. I assume Hazel is able to access the entire hierarchy since there seems to be the capability to do e.g. "Document" or "PDF" matches.

mdsl gives me:

kMDItemContentType = "dyn.ah62d46dzqm0gw23ssz1gw8brqz6gn25zsvu0e5dfhk2x465psa"
kMDItemContentTypeTree = (
"public.unix-executable",
"public.data",
"public.item",
"public.executable"
)

which leads me to think that something's amiss on my system. @a_freyer: is there any chance I you could post the output from mdls for a sketchup file on your system?
colin_young
 
Posts: 5
Joined: Sat Jan 19, 2013 5:17 pm

Same as yours for content type, but on mine "Sketchup Document" does show up as item kind.

EDIT ----------

And a further test shows that Hazel does properly match "SketchUp Document" on my machine.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Very odd. Does Hazel use Launch Services to identify the app? My naive reading of the situation is that SketchUp hasn't properly registered a UTI for their documents and are using a association by extension (much like a user can do by specifying the default application to open file types with). It's interesting that Finder can get the kind while Hazel cannot, leading me to believe they are using different mechanisms to determine the file type.

Thanks for the info.
colin_young
 
Posts: 5
Joined: Sat Jan 19, 2013 5:17 pm

You are correct in that there are different mechanisms. By default, Hazel will use Spotlight, but if the Spotlight data is missing, it will use LaunchServices as a backup. I'm guessing that Spotlight is indexing it but doing so incorrectly somehow. Maybe try doing 'mdimport' on the file and doing 'mdls' on it again to see if it changes? As it looks now, the Spotlight doesn't see a static type and generated one on the fly (hence it beginning with "dyn").
Mr_Noodle
Site Admin
 
Posts: 11951
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you.

mdimport <file name> seems to have done the trick. Hazel is now correctly identifying my SketchUp file. And, as a bonus I also know how to fix this the next time.
colin_young
 
Posts: 5
Joined: Sat Jan 19, 2013 5:17 pm


Return to Support