Page 1 of 1
Rule matching kind = SketchUp document not working

Posted:
Sat Jan 19, 2013 5:33 pm
by colin_young
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?
Re: Rule matching kind = SketchUp document not working

Posted:
Mon Jan 21, 2013 6:25 pm
by a_freyer
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:
…
Re: Rule matching kind = SketchUp document not working

Posted:
Mon Jan 21, 2013 10:01 pm
by colin_young
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.
Re: Rule matching kind = SketchUp document not working

Posted:
Mon Jan 21, 2013 10:07 pm
by a_freyer
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.
Re: Rule matching kind = SketchUp document not working

Posted:
Tue Jan 22, 2013 1:44 pm
by Mr_Noodle
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.
Re: Rule matching kind = SketchUp document not working

Posted:
Tue Jan 22, 2013 7:44 pm
by colin_young
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?
Re: Rule matching kind = SketchUp document not working

Posted:
Tue Jan 22, 2013 7:48 pm
by a_freyer
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.
Re: Rule matching kind = SketchUp document not working

Posted:
Wed Jan 23, 2013 9:33 am
by colin_young
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.
Re: Rule matching kind = SketchUp document not working

Posted:
Wed Jan 23, 2013 3:07 pm
by Mr_Noodle
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").
Re: Rule matching kind = SketchUp document not working

Posted:
Wed Jan 23, 2013 8:04 pm
by colin_young
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.