Tuesday, March 23, 2010

What happened to File Assossiaction under Vista, Seven?

Back to my help-you-do-it articles...

One thing bothered me for a while: our dear Microsoft removed the file associations item that was under the Tools Menu.What the hell? I never quite understood why MS does that sometimes. Information Architecture is very important, and regrouping items might make things better for the user. However, those grouping and organizations should reflect what the user (us!) believes to be the right way to sort the information.

I mean, when asked the question, "where is the right place to put <something>?", the answer is usually "where most users think it will be!". So Microsoft, where do *you* think your users look for file associations? Where it has been for more than a decade, under the Tools menu!

When I was looking for it, to fix an association that another badly planned application decided to break, I immediately went to the Folder Options, under the Tools Menu and looked for the association, which was no longer there.

Before I panicked I decided to Google it, and found out that the associations are now under a specific application called Default Programs, under the Control Panel.

The Default Programs application is a more user-friendly version of the old File Associations tab. It lets the user change the default program that will open an file (based on the extension, as it's the custom in Windows), change the association between file extensions and programs, set the autoplay defaults, and even use a profile-like thing to rapid switch configurations for associations (which is done in order to enable the user to quick return to a Microsoft setting, of course).


So far, so good. If you need to reconfigure your file associations, you should look at this wizard.

HOWEVER, where is the "advanced" button? None. Microsoft thinks all of us, users (even those with a Enterprise Version of Windows Vista) are dumb. So there's no way to change how the application is executed, like, for example, which parameters would be provided when calling a program to open a certain file. in my case, I was simply trying to tell windows that Java jar files are opened by calling java -jar JARFILE.

Well, enough complaining. How do we do it? There are two shell utilities, ASSOC and FTYPE, that enables us to do it. If changing the place of the interfaces was a bit unfortunate, I must say that the new solution is way better. ASSOC and FTYPE lets us create a N to N association between file types and extensions, and it's much more clean than the way it worked with the old interface.

You must take two steps in any order when defining the associations:

Define the File Type
A file type is a kind of "profile" for your file (I think file class would be an even better name). You name it anything you'd like and informs how it's opened. On my Java JAR example:

FTYPE jarfile="C:\aplic\Java\jre6\bin\javaw.exe" -jar "%1" %*

where %1 is the filename that Windows will gladly pass to your application and %* tells windows to "pass everything else to the program the way you received it". The last one doesn't make much sense in Windows, but the truth is that the shell will also use this list to open files, so if you simply type the filename on the prompt, you end up opening the file.

Create the Association
Now, for the association itself,

ASSOC .jar=jarfile

which is quite intuitive: you tell Windows to threat files with .jar extension as jarfiles.

No comments :

Post a Comment